[squeak-dev] The Inbox: System-ct.1156.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Tue Dec 7 09:48:18 UTC 2021


Go ahead and merge it. ;o)
Am 06.12.2021 20:04:34 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>:
Hi Marcel,

was this a serious objection? :-) Since we have proper handling of file-drop events, this bug should not occur any longer. Could we get this patch merged? :-)

Best,
Christoph

---
Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]

On 2020-05-08T09:23:34+02:00, marcel.taeumel at hpi.de wrote:

> I like the duplicate prompt. :-D  Because the first is never at the position I acctually dropped the file. Only the second one is.
>
> Best,
> Marcel
> Am 05.05.2020 17:41:35 schrieb commits at source.squeak.org <commits at source.squeak.org>:
> Christoph Thiede uploaded a new version of System to project The Inbox:
> http://source.squeak.org/inbox/System-ct.1156.mcz
>
> ==================== Summary ====================
>
> Name: System-ct.1156
> Author: ct
> Time: 5 May 2020, 5:41:10.96399 pm
> UUID: 2ce2496e-92e9-f744-9a58-d9e9320adfab
> Ancestors: System-mt.1155
>
> Fixes double prompt for handling a dropped file when the first dialog was cancelled. Cleans up duplication between ExternalDropHandler >> #lookupServiceBasedHandler: and DefaultExternalDropHandler by deprecating the first one. Maybe we can also remove this method?
>
> =============== Diff against System-mt.1155 ===============
>
> Item was changed:
> ----- Method: DefaultExternalDropHandler>>chooseServiceFrom: (in category 'private') -----
> chooseServiceFrom: aCollection
> + "private - choose a service from aCollection asking the user if needed"
> + ^ aCollection size = 1
> - "private - choose a service from aCollection asking the user if needed"
> - ^aCollection size = 1
> ifTrue: [aCollection anyOne]
> + ifFalse: [UIManager default
> + chooseFrom: (aCollection collect: [:each | each label])
> - ifFalse:[UIManager default
> - chooseFrom: (aCollection collect:[:each| each label])
> values: aCollection
> title: 'You dropped a file. Please choose a service:' translated withCRs].!
>
> Item was changed:
> ----- Method: DefaultExternalDropHandler>>handle:in:dropEvent: (in category 'event handling') -----
> handle: dropStream in: pasteUp dropEvent: anEvent
> "the file was just droped, let's do our job"
> | fileName services chosen |
> fileName := dropStream name.
> services := self servicesForFileNamed: fileName.
> +
> -
> "no service, default behavior"
> + services ifEmpty: [
> + ^ UIManager default edit: dropStream contentsOfEntireFile].
> +
> - services isEmpty
> - ifTrue: [^UIManager default edit: dropStream contentsOfEntireFile].
> -
> chosen := self chooseServiceFrom: services.
> + chosen ifNotNil: [chosen performServiceFor: dropStream].!
> - chosen ifNotNil:[chosen performServiceFor: dropStream]!
>
> Item was changed:
> ----- Method: DefaultExternalDropHandler>>servicesForFileNamed: (in category 'private') -----
> servicesForFileNamed: aString
> + "private - answer a collection of file-services for the file named aString"
> +
> + ^ (FileServices itemsForFile: aString)
> + copyWithoutAll: self unwantedSelectors!
> - "private - answer a collection of file-services for the file named
> - aString"
> - | allServices |
> - allServices := FileServices itemsForFile: aString.
> - ^ allServices
> - reject: [:svc | self unwantedSelectors includes: svc selector]!
>
> Item was changed:
> ----- Method: ExternalDropHandler class>>defaultHandler (in category 'accessing') -----
> defaultHandler
> +
> + ^ DefaultHandler ifNil: [
> + DefaultHandler := ExternalDropHandler
> + type: nil
> + extension: nil
> + action: #edit]!
> - DefaultHandler ifNil: [DefaultHandler := ExternalDropHandler type: nil extension: nil action: [:dropStream | dropStream edit]].
> - ^DefaultHandler!
>
> Item was changed:
> ----- Method: ExternalDropHandler class>>lookupExternalDropHandler: (in category 'accessing') -----
> lookupExternalDropHandler: stream
>
> | types extension serviceHandler |
> types := stream mimeTypes.
>
> types ifNotNil: [
> + self registeredHandlers
> + detect: [:handler | handler matchesTypes: types]
> + ifFound: [:handler | ^ handler]].
> - self registeredHandlers do: [:handler |
> - (handler matchesTypes: types)
> - ifTrue: [^handler]]].
>
> extension := FileDirectory extensionFor: stream name.
> + self registeredHandlers
> + detect: [:handler | handler matchesExtension: extension]
> + ifFound: [:handler | ^ handler].
> +
> + ^ serviceHandler ifNil: [self defaultHandler]!
> - self registeredHandlers do: [:handler |
> - (handler matchesExtension: extension)
> - ifTrue: [^handler]].
> - serviceHandler := self lookupServiceBasedHandler: stream.
> - ^serviceHandler
> - ifNil: [self defaultHandler]!
>
> Item was changed:
> ----- Method: ExternalDropHandler class>>lookupServiceBasedHandler: (in category 'accessing') -----
> lookupServiceBasedHandler: dropStream
> +
> - "The file was just dropped; let's do our job"
> | fileName services theOne |
> + self deprecated: 'ct: Use DefaultExternalDropHandler'.
> fileName := dropStream name.
> -
> services := (FileServices itemsForFile: fileName)
> reject: [:svc | self unwantedSelectors includes: svc selector].
> +
> -
> "no service, default behavior"
> + services ifEmpty: [^ nil].
> +
> - services isEmpty
> - ifTrue: [^nil].
> -
> theOne := self chooseServiceFrom: services.
> + ^ theOne ifNotNil: [
> + ExternalDropHandler type: nil extension: nil action: [:stream | theOne performServiceFor: stream]]!
> - ^theOne
> - ifNotNil: [ExternalDropHandler type: nil extension: nil action: [:stream | theOne performServiceFor: stream]]!
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200508/058d55fc/attachment.html>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211207/ddb9031d/attachment-0001.html>


More information about the Squeak-dev mailing list