OSDN Git Service

a bug fix and an improvement
authorkurikinton <kurikinton@1b7a4b54-c1e6-488d-bad7-d7f5528e62ba>
Thu, 27 Feb 2014 05:52:15 +0000 (05:52 +0000)
committerkurikinton <kurikinton@1b7a4b54-c1e6-488d-bad7-d7f5528e62ba>
Thu, 27 Feb 2014 05:52:15 +0000 (05:52 +0000)
git-svn-id: svn+ssh://svn.osdn.net/svnroot/letter-fix/branches/mavericks/letter-fix@50 1b7a4b54-c1e6-488d-bad7-d7f5528e62ba

LFApp.h
LetterFix.m

diff --git a/LFApp.h b/LFApp.h
index 45c61c0..418a486 100644 (file)
--- a/LFApp.h
+++ b/LFApp.h
@@ -10,7 +10,7 @@
 #import <AppKit/AppKit.h>
 #import "LFMenu.h"
 
-#define LETTERFIX_VERSION "2.0.1"
+#define LETTERFIX_VERSION "2.1.0"
 
 enum LFver {
     LF_Unknown = -1,
index 1497e27..de7ad76 100644 (file)
@@ -12,6 +12,7 @@
 #import "LFApp.h"
 
 static NSMutableArray *khash;
+static NSMutableArray *check_at_save;
 static LFApp *app;
 static NSString *roman[] = {@"I", @"II", @"III", @"IV", @"V", @"VI", @"VII", @"VIII", @"IX", @"X"};
 static NSString *dep[] = {@"ミリ", @"キロ", @"センチ", @"メートル", @"グラム", @"トン", @"アール", @"ヘクタール",
@@ -495,25 +496,26 @@ void alert0DidEnd_returnCode_contextInfo_(id self, SEL _cmd, id alert, int retur
 
 void _LF_IMP_send_(id self, SEL _cmd, id arg1)
 {
-    //NSLog(@"_send: %llx", backendGetPreferredEncoding([self backEnd]));
-    backendSetPreferredEncoding([self backEnd], LF_Encoding_ISO2022JP); // 念のため
+    if ([app isActive] == NO) {
+       [self _LF_send: arg1];
+       return;
+    }
     
-    if (([app isActive] != NO) && (0 < fixLetter(self, [self webView], TRUE, FALSE))) {
+    backendSetPreferredEncoding([self backEnd], LF_Encoding_ISO2022JP);
+    if (0 < fixLetter(self, [self webView], TRUE, FALSE)) {
         NSAlert *alert = [[[NSAlert alloc] init] autorelease];
        [alert addButtonWithTitle:@"変換して送信"];
        [alert addButtonWithTitle:@"キャンセル"];
        [alert addButtonWithTitle:@"変換せずに送信"];
        [alert addButtonWithTitle:@"変換のみ"];
        [alert setMessageText:@"メッセージを変換して送信しますか?"];
-       [alert setInformativeText:@"送信しようとしているメッセージには ISO 2022-JP に変換できない文字が含まれています。"
-        @"ISO 2022-JP で送信するためには、これらの文字を変換可能なものに置き換える必要があります。\n"
-        @"変換せずに送信する場合、エンコーディング設定を「自動」に設定の上送信します。"];
+       [alert setInformativeText:@"送信しようとしているメッセージには ISO 2022-JP に変換できない文字が含まれています。"];
        [alert setAlertStyle:NSInformationalAlertStyle];
        [alert beginSheetModalForWindow:[self window]
                          modalDelegate:self
                         didEndSelector:@selector(_LF_alert1DidEnd:returnCode:contextInfo:)
                            contextInfo:arg1];
-    } else if (([app isActive] != NO) && ([app isCheckSubject] != NO) && checkSubject(self)) {
+    } else if (([app isCheckSubject] != NO) && checkSubject(self)) {
        _LF_alertSubject(self, _cmd, arg1);
     } else {
        [self _LF_send: arg1];
@@ -576,12 +578,13 @@ void alert3DidEnd_returnCode_contextInfo_(id self, SEL _cmd, id alert, int retur
 
 void _LF_IMP_saveDocument_(id self, SEL _cmd, id arg1)
 {
-    if (([app isActive] != NO) && (0 < fixLetter(self, [self webView], TRUE, FALSE)) && (backendGetPreferredEncoding([self backEnd]) == LF_Encoding_ISO2022JP)) {
+    if (([app isActive] != NO) && ([check_at_save containsObject:self]==NO) &&(0 < fixLetter(self, [self webView], TRUE, FALSE)) && (backendGetPreferredEncoding([self backEnd]) == LF_Encoding_ISO2022JP)) {
        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
        [alert addButtonWithTitle:@"変換"];
        [alert addButtonWithTitle:@"変換しない"];
        [alert setMessageText:@"保存前にメッセージを変換しますか?"];
-       [alert setInformativeText:@"このメッセージには ISO 2022-JP エンコーディングに変換できない文字が含まれています。"];
+       [alert setInformativeText:@"このメッセージには ISO 2022-JP エンコーディングに変換できない文字が含まれています。\n"
+        @"変換しないを選択した場合、メールの送信またはウインドウを開き直すまでエンコーディングの確認を行いません。"];
        [alert setAlertStyle:NSWarningAlertStyle];
        [alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(_LF_alert2DidEnd:returnCode:contextInfo:) contextInfo:arg1];
     } else {
@@ -594,6 +597,7 @@ void alert2DidEnd_returnCode_contextInfo_(id self, SEL _cmd, id alert, int retur
     if (returnCode == NSAlertFirstButtonReturn) {
        fixLetter(self, [self webView], FALSE, FALSE);
     } else if (returnCode == NSAlertSecondButtonReturn) {
+       [check_at_save addObject:self];
     }
     [[alert window] orderOut:arg1];
     [self _LF_saveDocument: (id)arg1];
@@ -616,6 +620,7 @@ void _LF_IMP_animationCompleted(id self, SEL _cmd)
     [self registerBundle];
     
     khash = [[NSMutableArray alloc] initWithCapacity:1];
+    check_at_save = [[NSMutableArray alloc] initWithCapacity:1];
     
     app = [[LFApp alloc] init];