[ENH] Celeste receives attachments

danielv at netvision.net.il danielv at netvision.net.il
Mon May 1 00:17:51 UTC 2000


[Displaying attachments inline - better than menu in TOC]
I agree attachments should display a token, not encoded contents.

One thing I thought on this topic - it's important to allow the user
several options when more than one is relevant (a gzipped changeset
attachment? should that be just saved? or maybe also decoded? or maybe
it should be decoded and filedIntoItsOwnChangeset?).

I won't do the attributed text - I may have an alternative but that's a
bit wild and definitely farther off - I thought MIMEParts could display
themselves in a style similar to SyntaxMorphs, except they'd have a
part-type sensitive menu, and be editable.

Anyway, I'm in an optimizing - not interface - kind of mood, so I'm not
going back to writing interface at least until I've eliminated all those
long saves after every twitch ;-)...

Bob Arning <arning at charm.net> wrote:
> On Fri, 28 Apr 2000 09:56:19 "Lex Spoon" <lex at cc.gatech.edu> wrote:
> >As for the UI, I've been thinking that instead of a menu, a good way to
> >handle attachments would be to make a link within the text which is
> >hyperlinked to the attachment.  Clicking on the link would give you a
> >small menu with things like "open in window" or "save to file".  
> >Really, it should be a very similar menu to the one that FileList has.
> >
> >To make such a link, one first makes a new subclass of TextAttribute
> >with the relevant instance variables (probably data, content-type, and
> >default file name).  Adding the attribute to your text is a small
> >challenge, but AttributedTextStream should be useful here.
> 
> Here are some snippets that I use. The full context is available at 
> 
> 	http://www.charm.net/~arning/SqMailServer.24Apr1833.cs
> 
> It could use a little polish, but it keeps me happy WRT attachments.
> 
> Cheers,
> Bob
> 
> ===== code folows =====
> 'From Squeak2.8alpha of 13 January 2000 [latest update: #2042] on 30 April 2000 at 11:39:54 am'!
> Object subclass: #AttachedFileRepresentation
> 	instanceVariableNames: 'stream fileName fileType creator finderFlags dataStart dataLength resourceStart resourceLength '
> 	classVariableNames: ''
> 	poolDictionaries: ''
> 	category: 'Collections-Streams'!
> 
> !AttachedFileRepresentation methodsFor: 'as yet unclassified' stamp: 'RAA 3/17/1999 18:02'!
> contents
> 
> 	^stream contents copyFrom: dataStart + 1 to: dataStart + dataLength! !
> 
> !AttachedFileRepresentation methodsFor: 'as yet unclassified' stamp: 'RAA 2/28/1999 21:19'!
> defaultFileName: aString
> 
> 	fileName ifNil: [fileName _ aString]! !
> 
> !AttachedFileRepresentation methodsFor: 'as yet unclassified' stamp: 'RAA 2/28/1999 21:18'!
> printLinkOn: aStream
> 
> 	aStream
> 		nextPutAll: '<file:',(fileName ifNil: ['unknown']),'>'
> ! !
> 
> !AttachedFileRepresentation methodsFor: 'as yet unclassified' stamp: 'RAA 7/17/1998 00:32'!
> setStream: s 
> fileName: fn
> fileType: ft
> creator: cr 
> finderFlags: ff 
> dataStart: ds 
> dataLength: dl 
> resourceStart: rs 
> resourceLength: rl
> 
> 	stream _ s.
> 	fileName _ fn.
> 	fileType _ ft.
> 	creator _ cr.
> 	finderFlags _ ff.
> 	dataStart _ ds.
> 	dataLength _ dl.
> 	resourceStart _ rs.
> 	resourceLength _ rl.
> ! !
> 
> !AttachedFileRepresentation methodsFor: 'as yet unclassified' stamp: 'RAA 4/21/2000 11:20'!
> view
> 
> 	| fn dir fn2 i |
> 	"StringHolder new contents: self contents; openAsMorphLabel: fileName"
> 
> 	fn _ fileName.
> 	(fn isNil or: [fn isEmpty]) ifTrue: [
> 		fn _ '???'
> 	].
> 	dir _ FileDirectory default.
> 	fn2 _ fn.
> 	i _ 0.
> 	[dir fileExists: fn2] whileTrue: [
> 		fn2 _ fn,'.',(i _ i + 1) printString
> 	].
> 	(
> 		FileList 
> 			openMorphOn: (dir newFileNamed: fn2) 
> 			editString: self contents
> 	) openInWorld! !
> 
> 
> !EekMailFormatter methodsFor: 'as yet unclassified' stamp: 'RAA 7/17/1998 14:49'!
> makeStyleLinkFrom: start to: stop numbered: anInteger in: aText
> 
> 	aText 
> 		addAttribute: (TextDoIt evalString: 'self handleAttachmentLink: ',anInteger asString) 
> 		from: start 
> 		to: stop
> ! !
> 
> !EekMailFormatter methodsFor: 'as yet unclassified' stamp: 'RAA 2/28/1999 21:19'!
> parseApplicationFrom: aStream withDelimiter: delimiter with: localHeaders
> 
> 	| thereIsMore attachmentOnly theAttachment attachStart localDisposition localFileName |
> 
> 	thereIsMore _ self 
> 					skipBodyFrom: aStream 
> 					upTo: '--',delimiter 
> 					or: '--',delimiter,'--'
> 					addingTo: (attachmentOnly _ ReadWriteStream on: '').
> 	theAttachment _ self parseAttachment: attachmentOnly with: localHeaders.
> 	localDisposition _ localHeaders findHeaderType: 'Content-Disposition'.
> 	localFileName _ self parse: localDisposition forKeyword: 'filename='.
> 	theAttachment defaultFileName: localFileName.
> 
> 	attachments add: theAttachment.
> 	attachStart _ outputStream position + 1.
> 	theAttachment printLinkOn: outputStream.
> 	outputStream cr.
> 	restylingRanges add: {#makeStyleLinkFrom:to:numbered:in:. attachStart. 
> 							outputStream position - 1. attachments size}.
> 	^thereIsMore
> 
> ! !
> 
> 
> !EekMailWindow methodsFor: 'as yet unclassified' stamp: 'RAA 7/17/1998 15:05'!
> handleAttachmentLink: info
> 
> 	(currentMessage attachments at: info) view.! !





More information about the Squeak-dev mailing list