[zephyrchat-cvs] zchat/zChat ZCChatWindowController.mm,1.23,1.24
Status: Alpha
Brought to you by:
akosut
|
From: <ak...@us...> - 2003-04-11 17:01:16
|
Update of /cvsroot/zephyrchat/zchat/zChat
In directory sc8-pr-cvs1:/tmp/cvs-serv12534
Modified Files:
ZCChatWindowController.mm
Log Message:
Display error if save failed.
Index: ZCChatWindowController.mm
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/ZCChatWindowController.mm,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ZCChatWindowController.mm 3 Apr 2003 18:08:20 -0000 1.23
+++ ZCChatWindowController.mm 11 Apr 2003 17:01:09 -0000 1.24
@@ -250,11 +250,20 @@
- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
if (returnCode == NSOKButton) {
+ bool success;
+
if ([[[sheet filename] pathExtension] isEqualToString:@"rtf"]) {
- [[_output RTFFromRange:NSMakeRange(0, [[_output textStorage] length])]
+ success = [[_output RTFFromRange:NSMakeRange(0, [[_output textStorage] length])]
writeToURL:[sheet URL] atomically:YES];
} else {
- [[_output string] writeToURL:[sheet URL] atomically:YES];
+ success = [[_output string] writeToURL:[sheet URL] atomically:YES];
+ }
+
+ if (!success) {
+ [sheet orderOut:nil];
+ NSBeginCriticalAlertSheet(NSLocalizedString(@"COULDNT_SAVE_TITLE", nil),
+ nil, nil, nil, [self window], nil, nil, nil, nil,
+ NSLocalizedString(@"COULDNT_SAVE_FMT", nil), [sheet filename]);
}
}
|