From 70d5ffd42092cb33f4a0d37e7df25cf56379ce1a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 15 Sep 2008 17:14:39 -0400 Subject: [PATCH] Use the upload-safe name to display the filename after successful printing, and only clear the file after a success * Source/AppController.m: (uploadAndPrint:): Only call -clearFile after a successful print, and show the filename of the just-printed file --- Source/AppController.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/AppController.m b/Source/AppController.m index f878d00..ca33061 100644 --- a/Source/AppController.m +++ b/Source/AppController.m @@ -136,7 +136,8 @@ FILE *localFile; struct stat fileInfo; - const char *fileName = [[self getUploadSafeName:[dragRegion filePath]] UTF8String]; + NSString *uploadName = [self getUploadSafeName:[dragRegion filePath]]; + const char *fileName = [uploadName UTF8String]; [self setStatus:@"Connecting to acs.bu.edu" isError:NO]; struct sockaddr_in sin; @@ -248,7 +249,6 @@ NSString *printer = [[printersController selection] valueForKey:@"unixName"]; cmd = (char *)[[NSString stringWithFormat:@"lpr -m -#%d -P%@ %s\r\n\0", [[copiesButtons selectedCell] tag], printer, fileName] UTF8String]; #else - NSLog(@"tag = %@ [%d]", [copiesButtons selectedCell], [[copiesButtons selectedCell] tag]); if ([[copiesButtons selectedCell] tag] == 1) cmd = "touch __PRINT_1__\r\n\0"; else @@ -262,7 +262,9 @@ libssh2_channel_write(channel, cmd, sizeof(char) * strlen(cmd)); [self readChannel:channel]; - [self setStatus:@"Printed!" isError:NO]; + [self setStatus:[NSString stringWithFormat:@"Printed %@", uploadName] isError:NO]; + + [dragRegion clearFile]; libssh2_channel_send_eof(channel); libssh2_channel_eof(channel); @@ -279,7 +281,6 @@ shutdown: close(sock); - [dragRegion clearFile]; [progress stopAnimation:self]; [pool release]; -- 2.43.5