FileApplicationNoteBook.st
branchjv
changeset 12406 1fbd331e4489
parent 12401 4714b9640528
parent 12405 76f9a872362b
child 12431 9f0c59c742d5
--- a/FileApplicationNoteBook.st	Mon Feb 04 23:58:23 2013 +0100
+++ b/FileApplicationNoteBook.st	Fri Feb 08 08:51:42 2013 +0100
@@ -82,7 +82,7 @@
 		textEditorModificationTime checkModifiedBlock fileEncodingHolder
 		doNotShowFontDialog lockFileEncodingHolder enableSelectInBrowser
 		tagsBrowserVisibleHolder tagsBrowser'
-	classVariableNames:'DefaultTagsBrowserVisible'
+	classVariableNames:'DefaultTagsBrowserVisible MaxFileSizeLoadedWithoutAsking'
 	poolDictionaries:''
 	privateIn:FileApplicationNoteBook
 !
@@ -5067,7 +5067,8 @@
 !
 
 getContents
-    |file fileSize contents presentation alreadyConfirmed answer sizeLimit showLastPart|
+    |file fileSize contents presentation alreadyConfirmed answer sizeLimit showLastPart
+     dontAskAgainHolder|
 
     file := self fileName.
     file isNil ifTrue:[
@@ -5082,16 +5083,37 @@
 
     presentation := self presentation.
     presentation == #asText ifTrue:[
-        fileSize > (8 * 1024 * 1024) ifTrue:[
-            answer := OptionBox  
-                        request:(resources
+        fileSize > (MaxFileSizeLoadedWithoutAsking ? (8 * 1024 * 1024)) ifTrue:[
+            dontAskAgainHolder := false asValue.    
+            answer := Dialog
+                        confirmWithCancel:(resources
                                     stringWithCRs:'%1 is very large (%2).\\Show all or only the first 8 Mb ?' 
                                     with:file baseName allBold 
                                     with:(UnitConverter fileSizeStringFor:fileSize))
-                        label:(resources string:'Large File')
-                        buttonLabels:(resources array:#('Cancel' 'Show All' 'Show Last Part' 'Show First Part' ))
-                        values:#(#abort #all #last #first)
-                        default:#abort.
+                        labels:(resources array:#('Cancel' 'Show All' 'Show Last Part' 'Show First Part' )) 
+                        values:#(#abort #all #last #first) 
+                        default:#abort 
+                        check:(resources string:'Don''t ask again up to this size') on:dontAskAgainHolder 
+                        title:(resources string:'Large File').
+
+            answer == #all ifTrue:[
+                dontAskAgainHolder value ifTrue:[
+                    MaxFileSizeLoadedWithoutAsking := fileSize + 4096
+                ]
+            ].
+
+"/ old
+"/            answer := OptionBox  
+"/                        request:(resources
+"/                                    stringWithCRs:'%1 is very large (%2).\\Show all or only the first 8 Mb ?' 
+"/                                    with:file baseName allBold 
+"/                                    with:(UnitConverter fileSizeStringFor:fileSize))
+"/                        label:(resources string:'Large File')
+"/                        buttonLabels:(resources array:#('Cancel' 'Show All' 'Show Last Part' 'Show First Part' ))
+"/                        values:#(#abort #all #last #first)
+"/                        default:#abort.
+
+"/ very old
 "/            answer := Dialog
 "/                            confirmWithCancel:(resources
 "/                                                stringWithCRs:'%1 is very large (%2).\\Show all or only the first 4 Mb ?' 
@@ -6865,11 +6887,11 @@
 !FileApplicationNoteBook class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.273 2013-01-18 11:29:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.275 2013-01-29 14:20:07 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.273 2013-01-18 11:29:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.275 2013-01-29 14:20:07 cg Exp $'
 !
 
 version_SVN