From 60501807b361ced9f594ba9c58331857e2011834 Mon Sep 17 00:00:00 2001 From: IceN9ne Date: Fri, 11 Nov 2016 23:19:46 -0500 Subject: KviIpEditor: Change to a QLineEdit and update code. * Changes from a multi-QLineEdit box for each part of the IP address to a single QLineEdit which allows pasting of IP addresses rather than having to hand type them in. * Uses Qt5's QHostAddress to proccess the input and validate the IPs * Fixes the OptionsWidget_servers to enable/disable the KviIpEditor depending on if the Cache IP checkbox is checked or not. --- src/modules/options/OptionsWidget_proxy.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/modules/options/OptionsWidget_proxy.cpp') diff --git a/src/modules/options/OptionsWidget_proxy.cpp b/src/modules/options/OptionsWidget_proxy.cpp index ad3d29c11..f05012f33 100644 --- a/src/modules/options/OptionsWidget_proxy.cpp +++ b/src/modules/options/OptionsWidget_proxy.cpp @@ -268,25 +268,20 @@ void OptionsWidget_proxy::saveLastItem() #endif m_pLastEditedItem->m_pProxyData->m_szIp = ""; - QString tmpAddr = m_pIpEditor->address(); - - if(!m_pIpEditor->hasEmptyFields()) + if(m_pIpEditor->isValid()) { + QString tmpAddr = m_pIpEditor->address(); #ifdef COMPILE_IPV6_SUPPORT if(m_pIPv6Check->isChecked()) { - if((!KviQString::equalCI(tmpAddr, "0:0:0:0:0:0:0:0")) && KviNetUtils::isValidStringIPv6(tmpAddr)) - { + if(tmpAddr != "::" && KviNetUtils::isValidStringIPv6(tmpAddr)) m_pLastEditedItem->m_pProxyData->m_szIp = tmpAddr; - } } else { #endif - if((!KviQString::equalCI(tmpAddr, "0.0.0.0")) && KviNetUtils::isValidStringIp(tmpAddr)) - { + if(tmpAddr != "0.0.0.0" && KviNetUtils::isValidStringIp(tmpAddr)) m_pLastEditedItem->m_pProxyData->m_szIp = tmpAddr; - } #ifdef COMPILE_IPV6_SUPPORT } #endif -- cgit v1.3.1-10-gc9f91