diff --git a/src/SettingsDialog.cpp b/src/SettingsDialog.cpp index e573842c4..b8ef6a59c 100644 --- a/src/SettingsDialog.cpp +++ b/src/SettingsDialog.cpp @@ -270,9 +270,6 @@ SettingsDialog::saveSettings() s->applyChanges(); s->sync(); - if ( m_restartRequired ) - QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until Tomahawk is restarted" ) ); - TomahawkUtils::NetworkProxyFactory* proxyFactory = TomahawkUtils::proxyFactory(); if ( !m_advancedWidgetUi->enableProxyCheckBox->isChecked() ) { @@ -290,6 +287,9 @@ SettingsDialog::saveSettings() proxyFactory->setNoProxyHosts( s->proxyNoProxyHosts().split( ' ', QString::SkipEmptyParts ) ); } } + + if ( m_restartRequired || proxyFactory->changed() ) + QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until Tomahawk is restarted" ) ); } @@ -364,6 +364,7 @@ void SettingsDialog::toggleProxyEnabled() { m_advancedWidgetUi->proxyButton->setEnabled( m_advancedWidgetUi->enableProxyCheckBox->isChecked() ); + m_restartRequired = (TomahawkSettings::instance()->proxyType() == QNetworkProxy::Socks5Proxy) != m_advancedWidgetUi->proxyButton->isEnabled(); } diff --git a/src/libtomahawk/utils/TomahawkUtils.cpp b/src/libtomahawk/utils/TomahawkUtils.cpp index 724b86bf8..80d99204f 100644 --- a/src/libtomahawk/utils/TomahawkUtils.cpp +++ b/src/libtomahawk/utils/TomahawkUtils.cpp @@ -467,6 +467,11 @@ NetworkProxyFactory::setNoProxyHosts( const QStringList& hosts ) void NetworkProxyFactory::setProxy( const QNetworkProxy& proxy ) { + + m_proxyChanged = false; + if( m_proxy != proxy ) + m_proxyChanged = true; + m_proxy = proxy; QFlags< QNetworkProxy::Capability > proxyCaps; proxyCaps |= QNetworkProxy::TunnelingCapability; diff --git a/src/libtomahawk/utils/TomahawkUtils.h b/src/libtomahawk/utils/TomahawkUtils.h index 524df0215..cf6d9d936 100644 --- a/src/libtomahawk/utils/TomahawkUtils.h +++ b/src/libtomahawk/utils/TomahawkUtils.h @@ -67,6 +67,7 @@ namespace TomahawkUtils public: NetworkProxyFactory() : m_proxy( QNetworkProxy::NoProxy ) + , m_proxyChanged( false ) {} NetworkProxyFactory( const NetworkProxyFactory &other ); @@ -81,10 +82,11 @@ namespace TomahawkUtils virtual NetworkProxyFactory& operator=( const NetworkProxyFactory &rhs ); virtual bool operator==( const NetworkProxyFactory &other ) const; - + bool changed() const { return m_proxyChanged; } private: QStringList m_noProxyHosts; QNetworkProxy m_proxy; + bool m_proxyChanged; }; DLLEXPORT bool headless();