From 00d8ff16f4292404166b9853f643278cdc5d0c45 Mon Sep 17 00:00:00 2001 From: Robert Sesek 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 @@ 352.00 YES - - + + YES @@ -1843,6 +1843,14 @@ 557 + + + goButton + + + + 558 + @@ -3178,11 +3186,11 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{21, 388}, {480, 434}} + {{399, 341}, {480, 434}} com.apple.InterfaceBuilder.CocoaPlugin - {{21, 388}, {480, 434}} + {{399, 341}, {480, 434}} {{542, 257}, {480, 434}} com.apple.InterfaceBuilder.CocoaPlugin @@ -3294,7 +3302,7 @@ - 557 + 558 @@ -3311,6 +3319,7 @@ YES dragRegion + goButton helpWebView helpWindow password @@ -3323,6 +3332,7 @@ YES DraggableImageView + NSButton WebView NSWindow NSSecureTextField 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