From 00d8ff16f4292404166b9853f643278cdc5d0c45 Mon Sep 17 00:00:00 2001 From: Robert Sesek <rsesek@bluestatic.org> Date: Wed, 10 Sep 2008 19:40:21 -0400 Subject: [PATCH] Clear the file after uploading (so people can't print the same document twice) * Source/AppController.h: Add an IBO for the "go" button * Source/AppController.m: (uploadAndPrint:): Disable the "go" button * English.lproj/MainMenu.xib: Hook up the IBO * Source/DraggableImageView.h+m: (clearFile): New method to clear the currently dropped file --- English.lproj/MainMenu.xib | 20 +++++++++++++++----- Source/AppController.h | 1 + Source/AppController.m | 2 ++ Source/DraggableImageView.h | 1 + Source/DraggableImageView.m | 12 ++++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 396fb36..a5c9776 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -8,9 +8,9 @@ <string key="IBDocument.HIToolboxVersion">352.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="106"/> <integer value="539"/> - <integer value="391"/> + <integer value="106"/> + <integer value="372"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1843,6 +1843,14 @@ </object> <int key="connectionID">557</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">goButton</string> + <reference key="source" ref="591533163"/> + <reference key="destination" ref="154094289"/> + </object> + <int key="connectionID">558</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -3178,11 +3186,11 @@ <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{21, 388}, {480, 434}}</string> + <string>{{399, 341}, {480, 434}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="0" id="8"/> <reference ref="8"/> - <string>{{21, 388}, {480, 434}}</string> + <string>{{399, 341}, {480, 434}}</string> <reference ref="8"/> <string>{{542, 257}, {480, 434}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -3294,7 +3302,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">557</int> + <int key="maxID">558</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -3311,6 +3319,7 @@ <object class="NSMutableArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>dragRegion</string> + <string>goButton</string> <string>helpWebView</string> <string>helpWindow</string> <string>password</string> @@ -3323,6 +3332,7 @@ <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>DraggableImageView</string> + <string>NSButton</string> <string>WebView</string> <string>NSWindow</string> <string>NSSecureTextField</string> diff --git a/Source/AppController.h b/Source/AppController.h index 1ac8a62..22125bb 100644 --- a/Source/AppController.h +++ b/Source/AppController.h @@ -22,6 +22,7 @@ { IBOutlet NSTextField *username; IBOutlet NSSecureTextField *password; + IBOutlet NSButton *goButton; IBOutlet NSProgressIndicator *progress; IBOutlet NSTextField *status; diff --git a/Source/AppController.m b/Source/AppController.m index 126f527..a4e6c51 100644 --- a/Source/AppController.m +++ b/Source/AppController.m @@ -131,6 +131,7 @@ [progress startAnimation:self]; [progress setHidden:NO]; [status setHidden:NO]; + [goButton setEnabled:NO]; FILE *localFile; struct stat fileInfo; @@ -273,6 +274,7 @@ shutdown: close(sock); + [dragRegion clearFile]; [progress stopAnimation:self]; [pool release]; diff --git a/Source/DraggableImageView.h b/Source/DraggableImageView.h index a5cc72d..4621cdc 100644 --- a/Source/DraggableImageView.h +++ b/Source/DraggableImageView.h @@ -24,6 +24,7 @@ NSString *filePath; } +- (void)clearFile; - (NSString *)filePath; @end diff --git a/Source/DraggableImageView.m b/Source/DraggableImageView.m index c0d423b..2493957 100644 --- a/Source/DraggableImageView.m +++ b/Source/DraggableImageView.m @@ -36,6 +36,18 @@ return filePath; } +/** + * Clears the file from selection + */ +- (void)clearFile +{ + [filePath release]; + filePath = nil; + [pathDisplay setStringValue:@""]; + [self setImage:nil]; + [printButton setEnabled:NO]; +} + /** * Dealloc */ -- 2.43.5