Use the upload-safe name to display the filename after successful printing, and only...
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 15 Sep 2008 21:14:39 +0000 (17:14 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 15 Sep 2008 21:14:39 +0000 (17:14 -0400)
* Source/AppController.m:
(uploadAndPrint:): Only call -clearFile after a successful print, and show the filename of the just-printed file

Source/AppController.m

index f878d00af589d38663e460e1071bc5382f1104d0..ca330612f91c6f3d87ba6146e6a67576cd733030 100644 (file)
        
        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;
        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
        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];