ImageEditor.st
changeset 2866 10f8ee0f23fe
parent 2841 5f247fa01174
child 2870 0f130285be97
equal deleted inserted replaced
2865:2600408a8005 2866:10f8ee0f23fe
  6298 !
  6298 !
  6299 
  6299 
  6300 doLoadFromURL
  6300 doLoadFromURL
  6301     "opens a dialog for loading an image from a URL"
  6301     "opens a dialog for loading an image from a URL"
  6302 
  6302 
  6303     |tempFile url|
  6303     |tempFile url response|
  6304 
  6304 
  6305     self checkModified ifFalse:[ ^ self ].
  6305     self checkModified ifFalse:[ ^ self ].
  6306 
  6306 
  6307     url := Dialog 
  6307     url := Dialog 
  6308                 request:'Load Image from URL'
  6308                 request:(resources string:'Load Image from URL')
  6309                 initialAnswer:LastURL.
  6309                 initialAnswer:LastURL.
  6310 
  6310 
  6311     url notEmptyOrNil ifTrue:[
  6311     url notEmptyOrNil ifTrue:[
  6312         LastURL := url.
  6312         LastURL := url.
  6313         tempFile := Filename newTemporary.
  6313         tempFile := Filename newTemporary.
  6314         HTTPInterface get:url destinationFile:tempFile.
  6314         self withWaitCursorDo:[
  6315         self loadFromFile:tempFile.
  6315             response := HTTPInterface get:url destinationFile:tempFile.
       
  6316         ].
       
  6317         response isErrorResponse ifTrue:[
       
  6318             Dialog warn:(resources string:'Could not load image ("%1")' with:response responseText).
       
  6319         ] ifFalse:[
       
  6320             self loadFromFile:tempFile.
       
  6321         ].
  6316         tempFile delete
  6322         tempFile delete
  6317     ]
  6323     ]
  6318 
  6324 
  6319     "Created: / 20-09-2010 / 11:30:59 / cg"
  6325     "Created: / 20-09-2010 / 11:30:59 / cg"
  6320 !
  6326 !