Author: mherger
Date: Wed Aug 31 00:35:21 2011
New Revision: 9496

URL: http://svn.slimdevices.com/jive?rev=9496&view=rev
Log:
Bug: n/a
Description: in an attempt to escape the URL input screen people often 
accidentally invalidate the default url. If the new value is a sub-string of 
the default value, replace it with the default value.

Modified:
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua?rev=9496&r1=9495&r2=9496&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua
 Wed Aug 31 00:35:21 2011
@@ -40,6 +40,8 @@
 function __init(self, applet)
        log:info("initialize ImageSourceHttp")
        obj = oo.rawnew(self, ImageSource(applet))
+
+       obj:_fixImageListURL()
 
        obj.imgFiles = {}
        obj:readImageList()
@@ -149,6 +151,8 @@
                        log:debug("Input " .. value)
                        self.applet:getSettings()["http.path"] = value
                        self.applet:storeSettings()
+                       
+                       self:_fixImageListURL();
 
                        window:playSound("WINDOWSHOW")
                        window:hide(Window.transitionPushLeft)
@@ -166,6 +170,21 @@
        return window
 end
 
+
+-- in an attempt to escape the URL input screen people often accidentally 
invalidate the default url
+-- if the new value is a sub-string of the default value, revert it
+function _fixImageListURL(self)
+       local urlString  = self.applet:getSettings()["http.path"]
+       local defaultUrl = self.applet:getDefaultSettings()["http.path"]
+       
+       if (urlString != defaultUrl and string.find(defaultUrl, urlString, 1, 
true)) then
+               log:warn("Invalid URL: " .. urlString)
+               log:warn("Replacing with default value")
+               self.applet:getSettings()["http.path"] = defaultUrl
+               self.applet:storeSettings()
+       end 
+end
+
 --[[
 
 =head1 LICENSE

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to