Showing with 17 additions and 4 deletions.
  1. +17 −4 python/pyplugin_installer/installer_data.py
21 changes: 17 additions & 4 deletions python/pyplugin_installer/installer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def __init__(self,*args):
if settings.value("/proxyEnabled", False, type=bool):
self.proxy=QNetworkProxy()
proxyType = settings.value( "/proxyType", "0", type=unicode)
if len(args)>0 and settings.value("/proxyExcludedUrls","", type=unicode).contains(args[0]):
if len(args) > 0 and settings.value("/proxyExcludedUrls","", type=unicode).find(args[0]) > -1:
proxyType = "NoProxy"
if proxyType in ["1","Socks5Proxy"]: self.proxy.setType(QNetworkProxy.Socks5Proxy)
elif proxyType in ["2","NoProxy"]: self.proxy.setType(QNetworkProxy.NoProxy)
Expand All @@ -189,7 +189,11 @@ def __init__(self,*args):
elif proxyType in ["5","FtpCachingProxy"] and QT_VERSION >= 0X040400: self.proxy.setType(QNetworkProxy.FtpCachingProxy)
else: self.proxy.setType(QNetworkProxy.DefaultProxy)
self.proxy.setHostName(settings.value("/proxyHost","", type=unicode))
self.proxy.setPort(settings.value("/proxyPort", 0, type=int))
try:
# QSettings may contain non-int value...
self.proxy.setPort(settings.value("/proxyPort", 0, type=int))
except:
pass
self.proxy.setUser(settings.value("/proxyUser", "", type=unicode))
self.proxy.setPassword(settings.value("/proxyPassword", "", type=unicode))
self.setProxy(self.proxy)
Expand Down Expand Up @@ -320,7 +324,12 @@ def setCheckingOnStart(self, state):
def checkingOnStartInterval(self):
""" return checking for news and updates interval """
settings = QSettings()
i = settings.value(settingsGroup+"/checkOnStartInterval", 1, type=int)
try:
# QSettings may contain non-int value...
i = settings.value(settingsGroup+"/checkOnStartInterval", 1, type=int)
except:
# fallback do 1 day by default
i = 1
if i < 0: i = 1
# allowed values: 0,1,3,7,14,30 days
interval = 0
Expand Down Expand Up @@ -350,7 +359,11 @@ def timeForChecking(self):
if self.checkingOnStartInterval() == 0:
return True
settings = QSettings()
interval = settings.value(settingsGroup+"/checkOnStartLastDate",type=QDate).daysTo(QDate.currentDate())
try:
# QSettings may contain ivalid value...
interval = settings.value(settingsGroup+"/checkOnStartLastDate",type=QDate).daysTo(QDate.currentDate())
except:
interval = 0
if interval >= self.checkingOnStartInterval():
return True
else:
Expand Down