This repository was archived by the owner on Aug 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMIMEfixbundle.m
More file actions
101 lines (93 loc) · 2.91 KB
/
Copy pathMIMEfixbundle.m
File metadata and controls
101 lines (93 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// MIMEfixbundle.m
// MIMEfix
//
// Created by Kobayashi Katsushi on 06/02/21.
// Copyright 2006 Katsushi Kobayashi. All rights reserved.
//
//
// $Id: MIMEfixbundle.m,v 1.1.1.1 2006-06-20 05:55:37 ikob Exp $
//
#import "MIMEfixPreferences.h"
#import "MIMEfixbundle.h"
#import "JMUtilities.h"
#import "base64.h"
static BOOL MIMEfixWorks = YES;
NSBundle *GetMyMVMailBundle(void) {
return [NSBundle bundleForClass:[MIMEfixMailBundle class]];
}
@implementation MIMEfixMailBundle
+ (void) initialize
{
#if 1
#ifdef DEBUG
NSLog(@"Loading Bundle.");
#endif
[super initialize];
Class mvMailBundleClass = NSClassFromString(@"MVMailBundle");
class_setSuperclass([self class], mvMailBundleClass);
NSImage *image = [[NSImage alloc] initByReferencingFile:[GetMyMVMailBundle() pathForImageResource:@"MIMEfix"]];
[image setName:@"MIMEfix"];
[MIMEfixMailBundle registerBundle];
#else
NSBundle *myBundle;
[super initialize];
myBundle = [NSBundle bundleForClass:self];
[(NSImage *)[[NSImage alloc] initByReferencingFile:[myBundle pathForImageResource:@"MIMEfix"]] setName:@"MIMEfix"];
[self registerBundle];
#endif
#ifdef DEBUG
NSLog(@"Loaded MIMEfixMailBundle. (DEBUG) %@", [[[[NSBundle bundleForClass:[self class]] infoDictionary] objectForKey:@"CFBundleVersion"]
stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"$"]]);
#else
NSLog(@"Loaded MIMEfixMailBundle. %@", [[[[NSBundle bundleForClass:[self class]] infoDictionary] objectForKey:@"CFBundleVersion"]
stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"$"]]);
#endif
#if 0
NSDictionary* infoDictionary = [[NSBundle bundleForClass:[self class]] infoDictionary];
NSLog(@"%i Keys: %@", [infoDictionary count], [infoDictionary allKeys]);
#endif
}
+ (BOOL) hasPreferencesPanel
{
#ifdef DEBUG
NSLog(@"Has Preference.");
#endif
return MIMEfixWorks;
}
+ (NSString *) preferencesOwnerClassName
{
#ifdef DEBUG
NSLog(@"Respond Preference owner class name %@.", NSStringFromClass([MIMEfixPreferences class]));
#endif
return NSStringFromClass([MIMEfixPreferences class]);
}
+ (BOOL) MIMEfixWorks
{
return MIMEfixWorks;
}
- (BOOL) MIMEfixWorks
{
return MIMEfixWorks;
}
+ (NSString *) preferencesPanelName {
return @"MIMEfix";
}
- (NSString *) version
{
return [[[[NSBundle bundleForClass:[self class]] infoDictionary] objectForKey:@"CFBundleVersion"]
stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"$"]];
}
- (BOOL) isEnabled {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"MIMEfixEnable"];
}
- (void) setEnabled:(BOOL) yesOrNo {
[[NSUserDefaults standardUserDefaults] setBool:yesOrNo forKey:@"MIMEfixEnable"];
}
- (BOOL) isPreferName {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"MIMEfixPreferName"];
}
- (void) setPreferName:(BOOL) yesOrNo {
[[NSUserDefaults standardUserDefaults] setBool:yesOrNo forKey:@"MIMEfixPreferName"];
}
@end