Revision: 4117
http://skim-app.svn.sourceforge.net/skim-app/?rev=4117&view=rev
Author: hofman
Date: 2008-07-02 10:30:33 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
Beep when emailing archive fails
Modified Paths:
--------------
trunk/SKPDFDocument.m
Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m 2008-07-02 16:47:14 UTC (rev 4116)
+++ trunk/SKPDFDocument.m 2008-07-02 17:30:33 UTC (rev 4117)
@@ -919,10 +919,10 @@
[alert beginSheetModalForWindow:[self windowForSheet] modalDelegate:self
didEndSelector:@selector(convertNotesSheetDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
}
-- (void)saveArchiveToFile:(NSString *)fileName {
- [NSTask runTaskWithLaunchPath:@"/usr/bin/tar"
- arguments:[NSArray arrayWithObjects:@"-czf", fileName,
[[[self fileURL] path] lastPathComponent], nil]
- currentDirectoryPath:[[[self fileURL] path]
stringByDeletingLastPathComponent]];
+- (BOOL)saveArchiveToFile:(NSString *)fileName {
+ return [NSTask runTaskWithLaunchPath:@"/usr/bin/tar"
+ arguments:[NSArray arrayWithObjects:@"-czf",
fileName, [[[self fileURL] path] lastPathComponent], nil]
+ currentDirectoryPath:[[[self fileURL] path]
stringByDeletingLastPathComponent]];
}
- (void)archiveSavePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode
contextInfo:(void *)contextInfo {
@@ -948,7 +948,7 @@
}
}
-- (void)emailAttachmentFile:(NSString *)fileName {
+- (BOOL)emailAttachmentFile:(NSString *)fileName {
NSMutableString *scriptString = nil;
NSString *mailAppName = nil;
@@ -986,11 +986,17 @@
if (scriptString) {
NSAppleScript *script = [[[NSAppleScript alloc]
initWithSource:scriptString] autorelease];
NSDictionary *errorDict = nil;
- if ([script compileAndReturnError:&errorDict] == NO)
+ if ([script compileAndReturnError:&errorDict] == NO) {
NSLog(@"Error compiling mail to script: %@", errorDict);
- else if ([script executeAndReturnError:&errorDict] == NO)
+ return NO;
+ }
+ if ([script executeAndReturnError:&errorDict] == NO) {
NSLog(@"Error running mail to script: %@", errorDict);
+ return NO;
+ }
+ return YES;
}
+ return NO;
}
- (IBAction)emailArchive:(id)sender {
@@ -998,8 +1004,8 @@
if (path && [[NSFileManager defaultManager] fileExistsAtPath:path] &&
[self isDocumentEdited] == NO) {
NSString *tmpDir =
SKUniqueDirectoryCreating(SKChewableItemsDirectory(), YES);
NSString *tmpFile = [tmpDir stringByAppendingPathComponent:[[[[self
fileURL] path] lastPathComponent] stringByReplacingPathExtension:@"tgz"]];
- [self saveArchiveToFile:tmpFile];
- [self emailAttachmentFile:tmpFile];
+ if ([self saveArchiveToFile:tmpFile] == NO || [self
emailAttachmentFile:tmpFile] == NO)
+ NSBeep();
} else {
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"You
must save this file first", @"Alert text when trying to create archive for
unsaved document") defaultButton:nil alternateButton:nil otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"The document has unsaved changes,
or has not previously been saved to disk.", @"Informative text in alert
dialog")];
[alert beginSheetModalForWindow:[self windowForSheet]
modalDelegate:nil didEndSelector:NULL contextInfo:NULL];
@@ -1024,7 +1030,8 @@
arguments = [NSArray arrayWithObjects:@"create", @"-srcfolder",
sourcePath, @"-format", @"UDZO", @"-volname", [[targetPath lastPathComponent]
stringByDeletingPathExtension], targetPath, nil];
}
- [NSTask runTaskWithLaunchPath:scriptPath arguments:arguments
currentDirectoryPath:[sourcePath stringByDeletingLastPathComponent]];
+ if ([NSTask runTaskWithLaunchPath:scriptPath arguments:arguments
currentDirectoryPath:[sourcePath stringByDeletingLastPathComponent]] == NO)
+ NSBeep();
[[self progressController] performSelectorOnMainThread:@selector(hide)
withObject:nil waitUntilDone:NO];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit