* Converts the account settings from the TruePreview preferences panel to a
* dictionary and saves the dictionary into the user defaults.
* @param inPath
* Unused.
* @param inObject
* Unused.
* @param inChange
* Unused.
* @param inContext
* The <code>NSArray</code> containing the account settings from the
* TruePreview preferences panel.
*/
- (void)observeValueForKeyPath:(NSString*)inPath
ofObject:(id)inObject
change:(NSDictionary*)inChange
context:(void*)inContext;
@end
TruePreview-1.8a3/Source/TruePreviewPreferencesModule.h
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreviewLibraryMessage.h
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewLibraryMessage.h (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewLibraryMessage.h (revision 67)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewLibraryMessage category for
+ * LibraryMessage.
+ * @copyright Copyright (c) 2009-2011 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+
+#import "TruePreview.h"
+
+/*!
+ * @class
+ * Adds a method for overriding the "mark as viewed" behavior of
+ * LibraryMessage.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface TruePreviewLibraryMessage : NSObject {
+}
+
+#pragma mark Instance methods
+/*! @group Instance methods */
+
+/*!
+ * Returns the TruePreview settings appropriate for this message.
+ * @result
+ * An NSMutableDictionary containing the keys delay,
+ * window, and scroll and their respective values
+ * based on the default settings and/or the settings for this message's
+ * account.
+ */
+- (NSMutableDictionary*)truePreviewSettings;
+
+@end
TruePreview-1.8a3/Source/TruePreviewLibraryMessage.h
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreviewMessageViewer.m
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewMessageViewer.m (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewMessageViewer.m (revision 67)
@@ -0,0 +1,355 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewMessageViewer.h"
+
+@implementation TruePreviewMessageViewer
+
+#pragma mark Class methods
+
++ (NSMutableDictionary*)truePreviewTimers {
+ TRUEPREVIEW_LOG();
+
+ static NSMutableDictionary* sTimers = nil;
+
+ if (sTimers == nil) {
+ sTimers = [[NSMutableDictionary alloc] initWithCapacity:1];
+ }
+
+ return sTimers;
+}
+
+#pragma mark Swizzled instance methods
+
+- (void)truePreviewDealloc {
+ TRUEPREVIEW_LOG();
+
+ [self truePreviewReset];
+ [[[self class] truePreviewTimers]
+ removeObjectForKey:[NSNumber numberWithUnsignedLongLong:(unsigned long long)self]
+ ];
+ [self truePreviewDealloc];
+}
+
+- (void)truePreviewForwardAsAttachment:(id)inSender {
+ TRUEPREVIEW_LOG(@"%@", inSender);
+
+ id theMessage = [self currentDisplayedMessage];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if ([[theSettings objectForKey:@"forward"] boolValue]) {
+ [self truePreviewReset];
+ [self truePreviewMarkMessagesAsViewed:[NSArray arrayWithObject:theMessage]];
+ }
+ }
+
+ [self truePreviewForwardAsAttachment:inSender];
+}
+
+- (void)truePreviewForwardMessage:(id)inSender {
+ TRUEPREVIEW_LOG(@"%@", inSender);
+
+ id theMessage = [self currentDisplayedMessage];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if ([[theSettings objectForKey:@"forward"] boolValue]) {
+ [self truePreviewReset];
+ [self truePreviewMarkMessagesAsViewed:[NSArray arrayWithObject:theMessage]];
+ }
+ }
+
+ [self truePreviewForwardMessage:inSender];
+}
+
+- (void)truePreviewMarkAsRead:(id)inSender {
+ TRUEPREVIEW_LOG(@"%@", inSender);
+
+ [self truePreviewReset];
+ [self truePreviewMarkAsRead:inSender];
+}
+
+- (void)truePreviewMarkAsUnread:(id)inSender {
+ TRUEPREVIEW_LOG(@"%@", inSender);
+
+ [self truePreviewReset];
+ [self truePreviewMarkAsUnread:inSender];
+}
+
+- (void)truePreviewMarkMessageAsViewed:(id)inMessage {
+ TRUEPREVIEW_LOG(@"%@", inMessage);
+
+ [self truePreviewCreateTimer:inMessage];
+}
+
+- (void)truePreviewMarkMessagesAsViewed:(NSArray*)inMessages {
+ TRUEPREVIEW_LOG(@"%@", inMessages);
+
+ [self truePreviewCreateTimer:inMessages];
+}
+
+- (void)truePreviewMessageWasDisplayedInTextView:(NSNotification*)inNotification {
+ TRUEPREVIEW_LOG(@"%@", inNotification);
+
+ [self truePreviewMessageWasDisplayedInTextView:inNotification];
+ [self truePreviewReset];
+/* TODO: IN PROGRESS
+ // we receive notifications from all MessageContentControllers
+ if ([inNotification object] != object_getIvar(self, class_getInstanceVariable([self class], "_contentController"))) {
+ return;
+ }
+
+ id theMessage = [[inNotification userInfo] objectForKey:@"MessageKey"];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if (
+ ([[theSettings objectForKey:@"delay"] floatValue] == TRUEPREVIEW_DELAY_IMMEDIATE)
+ || (
+ [[theSettings objectForKey:@"window"] boolValue]
+ && [self isKindOfClass:NSClassFromString(@"SingleMessageViewer")]
+ )
+ ) {
+ [self truePreviewReset];
+ [self truePreviewMarkMessagesAsViewed:[NSArray arrayWithObject:theMessage]];
+
+ return;
+ }
+
+ float theDelay = [[theSettings objectForKey:@"delay"] floatValue];
+
+ if (theDelay > TRUEPREVIEW_DELAY_IMMEDIATE) {
+ [self truePreviewReset];
+ [self
+ truePreviewSetTimer:[NSTimer
+ scheduledTimerWithTimeInterval:theDelay
+ target:self
+ selector:@selector(truePreviewTimerFired:)
+ userInfo:nil
+ repeats:NO
+ ]
+ ];
+ }
+
+ if (
+ ![self isKindOfClass:NSClassFromString(@"SingleMessageViewer")]
+ && [[theSettings objectForKey:@"scroll"] boolValue]
+ ) {
+ // listen for selection change (mouse down) on message content view
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(truePreviewMessageClickedOrScrolled:)
+ name:@"WebViewDidChangeSelectionNotification"
+ object:[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView]
+ ];
+
+ // listen for bounds change notification on the message's clip view
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(truePreviewMessageClickedOrScrolled:)
+ name:NSViewBoundsDidChangeNotification
+ object:[[[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView] enclosingScrollView] contentView]
+ ];
+ }
+ }
+*/
+}
+
+- (void)truePreviewReplyAllMessage:(id)inSender {
+ TRUEPREVIEW_LOG(@"%@", inSender);
+
+ id theMessage = [self currentDisplayedMessage];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if ([[theSettings objectForKey:@"reply"] boolValue]) {
+ [self truePreviewReset];
+ [self truePreviewMarkMessagesAsViewed:[NSArray arrayWithObject:theMessage]];
+ }
+ }
+
+ [self truePreviewReplyAllMessage:inSender];
+}
+
+- (void)truePreviewReplyMessage:(id)inSender {
+ TRUEPREVIEW_LOG(@"%@", inSender);
+
+ id theMessage = [self currentDisplayedMessage];
+
+ if ([theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if ([[theSettings objectForKey:@"reply"] boolValue]) {
+ [self truePreviewReset];
+ [self truePreviewMarkMessagesAsViewed:[NSArray arrayWithObject:theMessage]];
+ }
+ }
+
+ [self truePreviewReplyMessage:inSender];
+}
+
+- (void)truePreviewSelectedMessagesDidChangeInMessageList {
+ TRUEPREVIEW_LOG();
+
+ [self truePreviewReset];
+ [self truePreviewSelectedMessagesDidChangeInMessageList];
+}
+
+#pragma mark Accessors
+
+- (NSTimer*)truePreviewTimer {
+ TRUEPREVIEW_LOG();
+
+ return [[[self class] truePreviewTimers]
+ objectForKey:[NSNumber numberWithUnsignedLongLong:(unsigned long long)self]
+ ];
+}
+
+- (void)truePreviewSetTimer:(NSTimer*)inTimer {
+ TRUEPREVIEW_LOG(@"%@ (userInfo: %@)", inTimer, [inTimer userInfo]);
+
+ [[[self class] truePreviewTimers]
+ setObject:inTimer
+ forKey:[NSNumber numberWithUnsignedLongLong:(unsigned long long)self]
+ ];
+}
+
+#pragma mark Instance methods
+
+- (void)truePreviewCreateTimer:(id)inMessages {
+ TRUEPREVIEW_LOG(@"%@", inMessages);
+
+ if (![inMessages isKindOfClass:[NSArray class]]) {
+ inMessages = [NSArray arrayWithObject:inMessages];
+ }
+ else {
+ inMessages = [[inMessages copy] autorelease];
+ }
+
+ id theMessage = [inMessages objectAtIndex:0];
+
+ if (
+ ![theMessage isKindOfClass:NSClassFromString(@"LibraryMessage")]
+ || ![[self currentDisplayedMessage] isKindOfClass:NSClassFromString(@"LibraryMessage")]
+ ) {
+ return;
+ }
+
+ NSDictionary* theSettings = [theMessage truePreviewSettings];
+
+ if (
+ ([[theSettings objectForKey:@"delay"] floatValue] == TRUEPREVIEW_DELAY_IMMEDIATE)
+ || (
+ [[theSettings objectForKey:@"window"] boolValue]
+ && [self isKindOfClass:NSClassFromString(@"SingleMessageViewer")]
+ )
+ ) {
+ [self truePreviewReset];
+ [self truePreviewMarkMessagesAsViewed:inMessages];
+
+ return;
+ }
+
+ float theDelay = [[theSettings objectForKey:@"delay"] floatValue];
+
+ if (theDelay > TRUEPREVIEW_DELAY_IMMEDIATE) {
+ [self truePreviewReset];
+ [self
+ truePreviewSetTimer:[NSTimer
+ scheduledTimerWithTimeInterval:theDelay
+ target:self
+ selector:@selector(truePreviewTimerFired:)
+ userInfo:inMessages
+ repeats:NO
+ ]
+ ];
+ }
+}
+
+- (void)truePreviewReset {
+ TRUEPREVIEW_LOG();
+
+ NSTimer* theTimer = [self truePreviewTimer];
+
+ if ((theTimer != nil) && [theTimer isValid]) {
+ [theTimer invalidate];
+ }
+
+ // stop observing when changed
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:@"WebViewDidChangeSelectionNotification"
+ object:[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView]
+ ];
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:NSViewBoundsDidChangeNotification
+ object:[[[[object_getIvar(self, class_getInstanceVariable([self class], "_contentController")) currentDisplay] contentView] enclosingScrollView] contentView]
+ ];
+}
+
+- (void)truePreviewTimerFired:(NSTimer*)inTimer {
+ TRUEPREVIEW_LOG(@"%@ (userInfo: %@)", inTimer, [inTimer userInfo]);
+
+ id theMessages = [inTimer userInfo];
+
+ [self truePreviewReset];
+ [self truePreviewMarkMessagesAsViewed:theMessages];
+}
+
+- (void)truePreviewMessageClickedOrScrolled:(NSNotification*)inNotification {
+ TRUEPREVIEW_LOG(@"%@", inNotification);
+
+ // ignore the first time we get the notification; it may be an initial scroll
+ // to the origin after changing messages
+ static BOOL sIsFirstTime = YES;
+
+ if ([NSViewBoundsDidChangeNotification isEqualToString:[inNotification name]] && sIsFirstTime) {
+ sIsFirstTime = NO;
+
+ return;
+ }
+
+ sIsFirstTime = YES;
+
+ [self truePreviewReset];
+
+ if ([[self currentDisplayedMessage] isKindOfClass:NSClassFromString(@"LibraryMessage")]) {
+ [[self currentDisplayedMessage] truePreviewMarkAsViewed];
+ }
+}
+
+@end
Index: TruePreview-1.8a3/Source/TruePreviewPreferencesModule.m
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewPreferencesModule.m (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewPreferencesModule.m (revision 67)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewPreferencesModule.h"
+
+@implementation TruePreviewPreferencesModule
+
+#pragma mark NSPreferencesModule instance methods
+
+- (NSString*)preferencesNibName {
+ TRUEPREVIEW_LOG();
+
+ return @"TruePreviewPreferencesPanel";
+}
+
+- (void)willBeDisplayed {
+ TRUEPREVIEW_LOG();
+
+ [super willBeDisplayed];
+
+ // build the list of accounts
+ NSDictionary* theAccountDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewAccountSettings"];
+ NSMutableArray* theAccounts = [NSMutableArray array];
+ NSEnumerator* theEnum = [[[NSClassFromString(@"MailAccount") remoteAccounts] valueForKey:@"displayName"] objectEnumerator];
+ NSString* theDisplayName = nil;
+
+ while (theDisplayName = [theEnum nextObject]) {
+ NSMutableDictionary* theAccount = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ theDisplayName, @"displayName",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"delay",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"reply",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"forward",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"window",
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"scroll",
+ nil
+ ];
+
+ [theAccount addEntriesFromDictionary:[theAccountDict objectForKey:theDisplayName]];
+ [theAccounts addObject:theAccount];
+ }
+
+ // watch the array for changes to save the user defaults
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"delay"
+ options:0
+ context:theAccounts
+ ];
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"reply"
+ options:0
+ context:theAccounts
+ ];
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"forward"
+ options:0
+ context:theAccounts
+ ];
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"window"
+ options:0
+ context:theAccounts
+ ];
+ [theAccounts
+ addObserver:self
+ toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
+ forKeyPath:@"scroll"
+ options:0
+ context:theAccounts
+ ];
+
+ [fldAccountArrayController setContent:theAccounts];
+}
+
+#pragma mark NSKeyValueObserving instance methods
+
+- (void)observeValueForKeyPath:(NSString*)inPath
+ ofObject:(id)inObject
+ change:(NSDictionary*)inChange
+ context:(void*)inContext {
+ TRUEPREVIEW_LOG(@"%@, %@, %@, %p", inPath, inObject, inChange, inContext);
+
+ NSMutableDictionary* theAccountDict = [NSMutableDictionary dictionary];
+
+ // build the account settings dictionary to save in the user defaults
+ for (NSDictionary* theAccount in (NSArray*)inContext) {
+ [theAccountDict setObject:theAccount forKey:[theAccount objectForKey:@"displayName"]];
+ }
+
+ [[NSUserDefaults standardUserDefaults] setObject:theAccountDict forKey:@"TruePreviewAccountSettings"];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+}
+
+#pragma mark Instance methods
+
+- (NSString*)truePreviewVersion {
+ return [[[NSBundle bundleForClass:[TruePreview class]] infoDictionary] objectForKey:@"CFBundleVersion"];
+}
+
+@end
TruePreview-1.8a3/Source/TruePreviewPreferencesModule.m
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreviewLibraryMessage.m
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewLibraryMessage.m (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewLibraryMessage.m (revision 67)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewLibraryMessage.h"
+
+@implementation TruePreviewLibraryMessage
+
+#pragma mark Instance methods
+
+- (NSMutableDictionary*)truePreviewSettings {
+ TRUEPREVIEW_LOG();
+
+ NSMutableDictionary* theSettings = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewDelay"], @"delay",
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewReply"], @"reply",
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewForward"], @"forward",
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewWindow"], @"window",
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewScroll"], @"scroll",
+ nil
+ ];
+ NSMutableDictionary* theAccountSettings = [
+ [[NSUserDefaults standardUserDefaults] objectForKey:@"TruePreviewAccountSettings"]
+ objectForKey:[[self account] displayName]
+ ];
+
+ if (theAccountSettings != nil) {
+ for (id theKey in [NSArray arrayWithObjects:@"delay", @"reply", @"forward", @"window", @"scroll", nil]) {
+ id theValue = [theAccountSettings objectForKey:theKey];
+
+ if ((theValue != nil) && ([theValue intValue] != TRUEPREVIEW_DELAY_DEFAULT)) {
+ [theSettings setObject:theValue forKey:theKey];
+ }
+ }
+ }
+
+ return theSettings;
+}
+
+@end
TruePreview-1.8a3/Source/TruePreviewLibraryMessage.m
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreviewPreferenceValueTransformer.h
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewPreferenceValueTransformer.h (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewPreferenceValueTransformer.h (revision 67)
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewPreferenceValueTransformer
+ * NSValueTransformer subclasses.
+ * @copyright Copyright (c) 2009-2011 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id: TruePreviewPreferencesModule.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+
+/*!
+ * @class
+ * The TruePreviewPreferenceValueTransformer class is the subclass
+ * of NSValueTransformer that selects the correct radio button in
+ * the TruePreview preferences panel.
+ * @version \@(#) $Id: TruePreviewPreferencesModule.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+@interface TruePreviewPreferenceValueTransformer : NSValueTransformer {
+}
+
+#pragma mark NSValueTransformer class methods
+/*! @group NSValueTransformer class methods */
+
+/*!
+ * Returns the class of transformed values for this value transformer
+ * (NSNumber).
+ * @result
+ * [NSNumber class].
+ */
++ (Class)transformedValueClass;
+
+#pragma mark NSValueTransformer instance methods
+/*! @group NSValueTransformer instance methods */
+
+/*!
+ * Returns an NSNumber equivalent to the provided value if the
+ * value is TRUEPREVIEW_DELAY_IMMEDIATE,
+ * TRUEPREVIEW_DELAY_DEFAULT,
+ * TRUEPREVIEW_DELAY_NEVER, or > 0 to
+ * TRUEPREVIEW_DELAY_MAX; otherwise,
+ * TRUEPREVIEW_DELAY_DEFAULT is returned.
+ * @param inValue
+ * The value being transformed.
+ * @result
+ * An NSNumber containing the transformed value.
+ */
+- (id)transformedValue:(id)inValue;
+
+@end
+
+/*!
+ * @class
+ * The TruePreviewPreferenceValueTransformerDelay class is the
+ * subclass of NSValueTransformer that provides a value appropriate
+ * to display in controls in the TruePreview preferences panel.
+ * @version \@(#) $Id: TruePreviewPreferencesModule.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+@interface TruePreviewPreferenceValueTransformerDelay : NSValueTransformer {
+}
+
+#pragma mark NSValueTransformer class methods
+/*! @group NSValueTransformer class methods */
+
+/*!
+ * Returns the class of transformed values for this value transformer
+ * (NSNumber).
+ * @result
+ * [NSNumber class].
+ */
++ (Class)transformedValueClass;
+
+#pragma mark NSValueTransformer instance methods
+/*! @group NSValueTransformer instance methods */
+
+/*!
+ * Returns an NSNumber for displaying the delay in controls (i.e.
+ * > 0 to TRUEPREVIEW_DELAY_MAX or nil).
+ * @param inValue
+ * The value being transformed.
+ * @result
+ * An NSNumber containing the transformed value.
+ */
+- (id)transformedValue:(id)inValue;
+
+@end
+
+/*!
+ * @class
+ * The TruePreviewPreferenceValueTransformerDelayEditIndicator
+ * class is the subclass of NSValueTransformer that indicates
+ * whether or not delay controls should be enabled in the TruePreview
+ * preferences panel.
+ * @version \@(#) $Id: TruePreviewPreferencesModule.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+@interface TruePreviewPreferenceValueTransformerDelayEditIndicator : NSValueTransformer {
+}
+
+#pragma mark NSValueTransformer class methods
+/*! @group NSValueTransformer class methods */
+
+/*!
+ * Returns the class of transformed values for this value transformer
+ * (NSNumber).
+ * @result
+ * [NSNumber class].
+ */
++ (Class)transformedValueClass;
+
+#pragma mark NSValueTransformer instance methods
+/*! @group NSValueTransformer instance methods */
+
+/*!
+ * Returns an NSNumber indicating whether or not delay controls
+ * should be enabled (i.e. delay is > 0 to
+ * TRUEPREVIEW_DELAY_MAX).
+ * @param inValue
+ * The value being transformed.
+ * @result
+ * An NSNumber containing the transformed value.
+ */
+- (id)transformedValue:(id)inValue;
+
+@end
TruePreview-1.8a3/Source/TruePreviewPreferenceValueTransformer.h
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+text/x-c
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreview.h
===================================================================
--- TruePreview-1.8a3/Source/TruePreview.h (revision 0)
+++ TruePreview-1.8a3/Source/TruePreview.h (revision 67)
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreview Mail bundler (the entrypoint for the
+ * plugin) and the TruePreviewObject category for
+ * NSObject.
+ * @copyright Copyright (c) 2009-2011 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+
+#import
+
+#import "TruePreviewLibraryMessage.h"
+#import "TruePreviewMessageViewer.h"
+#import "TruePreviewPreferences.h"
+#import "TruePreviewPreferencesModule.h"
+#import "TruePreviewPreferenceValueTransformer.h"
+
+/*!
+ * @class
+ * The TruePreview class is the subclass of
+ * MVMailBundle that provides the plugin entrypoint for the
+ * TruePreview plugin.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface TruePreview : NSObject {
+}
+
+#pragma mark Class initialization
+/*! @group Class initialization */
+
+/*!
+ * Registers this plugin and swizzles the methods necessary for TruePreview's
+ * functionality.
+ */
++ (void)initialize;
+
+#pragma mark MVMailBundle class methods
+/*! @group MVMailBundle class methods */
+
+/*!
+ * Indicates that this plugin has a preference panel.
+ * @result
+ * YES.
+ */
++ (BOOL)hasPreferencesPanel;
+
+/*!
+ * Returns the class name for this plugin's preference panel owner.
+ * @result
+ * TruePreviewPreferencesModule.
+ */
++ (NSString*)preferencesOwnerClassName;
+
+/*!
+ * Returns the name for this plugin's preferences panel.
+ * @result
+ * TruePreview.
+ */
++ (NSString*)preferencesPanelName;
+
+@end
+
+/*!
+ * @category
+ * Adds a method for method swizzling to NSObject instances.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface NSObject (TruePreviewObject)
+
+#pragma mark Class methods
+/*! @group Class methods */
+
+/*!
+ * Adds the methods from this class to the specified class. This is in essence
+ * adding a category, but we do it through the objective-c runtime, because of
+ * the "hiding" of classes in >= 10.6.
+ * @param inClass
+ * The Class to which this class's methods should be added.
+ */
++ (void)truePreviewAddAsCategoryToClass:(Class)inClass;
+
+/*!
+ * Swaps ("swizzles") two methods. Based on
+ * http://www.cocoadev.com/index.pl?MethodSwizzling.
+ * @param inOriginalSelector
+ * The selector specifying the method being replaced.
+ * @param inReplacementSelector
+ * The selector specifying the replacement method.
+ * @param inIsClassMethod
+ * The BOOL indicating whether or not the methods being swizzled
+ * are class methods.
+ */
++ (void)truePreviewSwizzleMethod:(SEL)inOriginalSelector withMethod:(SEL)inReplacementSelector isClassMethod:(BOOL)inIsClassMethod;
+
+@end
\ No newline at end of file
TruePreview-1.8a3/Source/TruePreview.h
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreview_Prefix.pch
===================================================================
--- TruePreview-1.8a3/Source/TruePreview_Prefix.pch (revision 0)
+++ TruePreview-1.8a3/Source/TruePreview_Prefix.pch (revision 67)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef __OBJC__
+# import
+
+# define TRUEPREVIEW_DELAY_MAX 30
+# define TRUEPREVIEW_DELAY_IMMEDIATE 0
+# define TRUEPREVIEW_DELAY_DEFAULT -1
+# define TRUEPREVIEW_DELAY_NEVER -2
+
+# ifdef TRUEPREVIEW_DEBUG
+# define TRUEPREVIEW_LOG(inFormat, ...) NSLog((@"%s [line %d] (%p) " inFormat), __PRETTY_FUNCTION__, __LINE__, self, ##__VA_ARGS__);
+# else
+# define TRUEPREVIEW_LOG(...)
+# endif
+
+#endif
TruePreview-1.8a3/Source/TruePreview_Prefix.pch
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Source/AppKit/NSPreferencesModule.h
===================================================================
--- TruePreview-1.8a3/Source/AppKit/NSPreferencesModule.h (revision 0)
+++ TruePreview-1.8a3/Source/AppKit/NSPreferencesModule.h (revision 67)
@@ -0,0 +1,45 @@
+/*
+ * Generated by class-dump 3.3.1 (64 bit).
+ *
+ * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2009 by Steve Nygard.
+ */
+
+/*#import "NSObject.h"*/
+
+/*#import */
+
+@protocol NSPreferencesModule;
+@class NSBox;
+
+@interface NSPreferencesModule : NSObject
+{
+ NSBox *_preferencesView;
+ struct CGSize _minSize;
+ BOOL _hasChanges;
+ void *_reserved;
+}
+
++ (id)sharedInstance;
+- (void)dealloc;
+- (void)finalize;
+- (id)init;
+- (id)preferencesNibName;
+- (void)setPreferencesView:(id)arg1;
+- (id)viewForPreferenceNamed:(id)arg1;
+- (id)imageForPreferenceNamed:(id)arg1;
+- (id)titleForIdentifier:(id)arg1;
+- (BOOL)hasChangesPending;
+- (void)saveChanges;
+- (void)willBeDisplayed;
+- (void)initializeFromDefaults;
+- (void)didChange;
+- (struct CGSize)minSize;
+- (void)setMinSize:(struct CGSize)arg1;
+- (void)moduleWillBeRemoved;
+- (void)moduleWasInstalled;
+- (BOOL)moduleCanBeRemoved;
+- (BOOL)preferencesWindowShouldClose;
+- (BOOL)isResizable;
+
+@end
+
Index: TruePreview-1.8a3/Source/TruePreviewPreferences.h
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewPreferences.h (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewPreferences.h (revision 67)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewPreferences category for
+ * NSPreferences.
+ * @copyright Copyright (c) 2009-2011 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+
+#import "TruePreview.h"
+
+/*!
+ * @class
+ * Adds a method for overriding the preference-loading behavior of
+ * NSPreferences.
+ * @version \@(#) $Id$
+ * @updated $Date$
+ */
+@interface TruePreviewPreferences : NSObject {
+}
+
+#pragma mark Swizzled class methods
+/*! @group Swizzled class methods */
+
+/*!
+ * Adds the TruePreview preferences.
+ * @result
+ * The shared NSPreferences for this application.
+ */
++ (id)truePreviewSharedPreferences;
+
+@end
TruePreview-1.8a3/Source/TruePreviewPreferences.h
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreviewPreferenceValueTransformer.m
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewPreferenceValueTransformer.m (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewPreferenceValueTransformer.m (revision 67)
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewPreferenceValueTransformer.h"
+
+@implementation TruePreviewPreferenceValueTransformer
+
+#pragma mark NSValueTransformer class methods
+
++ (Class)transformedValueClass {
+ TRUEPREVIEW_LOG();
+
+ return [NSNumber class];
+}
+
+#pragma mark NSValueTransformer instance methods
+
+- (id)transformedValue:(id)inValue {
+ TRUEPREVIEW_LOG(@"%@", inValue);
+
+ float theValue = [inValue floatValue];
+
+ if ((theValue > 0) && (theValue <= TRUEPREVIEW_DELAY_MAX)) {
+ return [NSNumber numberWithInt:1];
+ }
+ else if (
+ (theValue == TRUEPREVIEW_DELAY_IMMEDIATE)
+ || (theValue == TRUEPREVIEW_DELAY_DEFAULT)
+ || (theValue == TRUEPREVIEW_DELAY_NEVER)
+ ) {
+ return [NSNumber numberWithInt:theValue];
+ }
+ else {
+ return [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT];
+ }
+}
+
+@end
+
+@implementation TruePreviewPreferenceValueTransformerDelay
+
+#pragma mark NSValueTransformer class methods
+
++ (Class)transformedValueClass {
+ TRUEPREVIEW_LOG();
+
+ return [NSNumber class];
+}
+
+#pragma mark NSValueTransformer instance methods
+
+- (id)transformedValue:(id)inValue {
+ TRUEPREVIEW_LOG(@"%@", inValue);
+
+ float theValue = [inValue floatValue];
+
+ if ((theValue <= 0) || (theValue > TRUEPREVIEW_DELAY_MAX)) {
+ return nil;
+ }
+ else {
+ return [NSNumber numberWithFloat:theValue];
+ }
+}
+
+@end
+
+@implementation TruePreviewPreferenceValueTransformerDelayEditIndicator
+
+#pragma mark NSValueTransformer class methods
+
++ (Class)transformedValueClass {
+ TRUEPREVIEW_LOG();
+
+ return [NSNumber class];
+}
+
+#pragma mark NSValueTransformer instance methods
+
+- (id)transformedValue:(id)inValue {
+ TRUEPREVIEW_LOG(@"%@", inValue);
+
+ float theValue = [inValue floatValue];
+
+ return [NSNumber numberWithInt:((theValue > 0) && (theValue <= TRUEPREVIEW_DELAY_MAX))];
+}
+
+@end
Index: TruePreview-1.8a3/Source/TruePreview.m
===================================================================
--- TruePreview-1.8a3/Source/TruePreview.m (revision 0)
+++ TruePreview-1.8a3/Source/TruePreview.m (revision 67)
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreview.h"
+
+@implementation TruePreview
+
+#pragma mark Class initialization
+
++ (void)initialize {
+ TRUEPREVIEW_LOG();
+
+ if (self == [TruePreview class]) {
+ class_setSuperclass(self, NSClassFromString(@"MVMailBundle"));
+ }
+
+ [super registerBundle];
+
+ // register the preferences value transformers
+ [NSValueTransformer
+ setValueTransformer:[[TruePreviewPreferenceValueTransformer alloc] init]
+ forName:@"TruePreviewPreferenceValueTransformer"
+ ];
+ [NSValueTransformer
+ setValueTransformer:[[TruePreviewPreferenceValueTransformerDelay alloc] init]
+ forName:@"TruePreviewPreferenceValueTransformerDelay"
+ ];
+ [NSValueTransformer
+ setValueTransformer:[[TruePreviewPreferenceValueTransformerDelayEditIndicator alloc] init]
+ forName:@"TruePreviewPreferenceValueTransformerDelayEditIndicator"
+ ];
+
+ // add our "categories"
+ [TruePreviewLibraryMessage truePreviewAddAsCategoryToClass:NSClassFromString(@"LibraryMessage")];
+ [TruePreviewMessageViewer truePreviewAddAsCategoryToClass:NSClassFromString(@"MessageViewer")];
+ [TruePreviewPreferences truePreviewAddAsCategoryToClass:NSClassFromString(@"NSPreferences")];
+
+ // do our swizzles
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(dealloc)
+ withMethod:@selector(truePreviewDealloc)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(markMessageAsViewed:)
+ withMethod:@selector(truePreviewMarkMessageAsViewed:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(markMessagesAsViewed:)
+ withMethod:@selector(truePreviewMarkMessagesAsViewed:)
+ isClassMethod:NO
+ ];
+/* TODO: IN PROGRESS
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(forwardAsAttachment:)
+ withMethod:@selector(truePreviewForwardAsAttachment:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(forwardMessage:)
+ withMethod:@selector(truePreviewForwardMessage:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(markAsRead:)
+ withMethod:@selector(truePreviewMarkAsRead:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(markAsUnread:)
+ withMethod:@selector(truePreviewMarkAsUnread:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(replyAllMessage:)
+ withMethod:@selector(truePreviewReplyAllMessage:)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(replyMessage:)
+ withMethod:@selector(truePreviewReplyMessage:)
+ isClassMethod:NO
+ ];
+*/
+ [NSClassFromString(@"MessageViewer")
+ truePreviewSwizzleMethod:@selector(selectedMessagesDidChangeInMessageList)
+ withMethod:@selector(truePreviewSelectedMessagesDidChangeInMessageList)
+ isClassMethod:NO
+ ];
+ [NSClassFromString(@"NSPreferences")
+ truePreviewSwizzleMethod:@selector(sharedPreferences)
+ withMethod:@selector(truePreviewSharedPreferences)
+ isClassMethod:YES
+ ];
+
+ // set defaults
+ [[NSUserDefaults standardUserDefaults]
+ registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt:TRUEPREVIEW_DELAY_IMMEDIATE], @"TruePreviewDelay",
+ [NSNumber numberWithInt:NSOnState], @"TruePreviewReply",
+ [NSNumber numberWithInt:NSOnState], @"TruePreviewForward",
+ [NSNumber numberWithInt:NSOnState], @"TruePreviewWindow",
+ [NSNumber numberWithInt:NSOffState], @"TruePreviewScroll",
+ nil
+ ]
+ ];
+
+ // we're all set
+ NSLog(
+ @"Loaded TruePreview plugin %@",
+ [[NSBundle bundleForClass:[TruePreview class]] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]
+ );
+}
+
+#pragma mark MVMailBundle class methods
+
++ (BOOL)hasPreferencesPanel {
+ TRUEPREVIEW_LOG();
+
+ return YES;
+}
+
++ (NSString*)preferencesOwnerClassName {
+ TRUEPREVIEW_LOG();
+
+ return @"TruePreviewPreferencesModule";
+}
+
++ (NSString*)preferencesPanelName {
+ TRUEPREVIEW_LOG();
+
+ return @"TruePreview";
+}
+
+@end
+
+@implementation NSObject (TruePreviewObject)
+
+#pragma mark Class methods
+
++ (void)truePreviewAddAsCategoryToClass:(Class)inClass {
+ TRUEPREVIEW_LOG(@"%@", inClass);
+
+ unsigned int theCount = 0;
+ Method* theMethods = class_copyMethodList(object_getClass([self class]), &theCount);
+ Class theClass = object_getClass(inClass);
+ unsigned int i = 0;
+
+ while (YES) {
+ for (i = 0; i < theCount; i++) {
+ if (
+ !class_addMethod(
+ theClass,
+ method_getName(theMethods[i]),
+ method_getImplementation(theMethods[i]),
+ method_getTypeEncoding(theMethods[i])
+ )
+ ) {
+ NSLog(
+ @"truePreviewAddAsCategoryToClass: could not add %@ to %@",
+ NSStringFromSelector(method_getName(theMethods[i])),
+ inClass
+ );
+ }
+ }
+
+ if (theMethods != nil) {
+ free(theMethods);
+ }
+
+ if (theClass != inClass) {
+ theClass = inClass;
+ theMethods = class_copyMethodList([self class], &theCount);
+ }
+ else {
+ break;
+ }
+ }
+}
+
++ (void)truePreviewSwizzleMethod:(SEL)inOriginalSelector withMethod:(SEL)inReplacementSelector isClassMethod:(BOOL)inIsClassMethod {
+ Method theOriginalMethod = (!inIsClassMethod
+ ? class_getInstanceMethod([self class], inOriginalSelector)
+ : class_getClassMethod([self class], inOriginalSelector)
+ );
+ Method theReplacementMethod = (!inIsClassMethod
+ ? class_getInstanceMethod([self class], inReplacementSelector)
+ : class_getClassMethod([self class], inReplacementSelector)
+ );
+
+ TRUEPREVIEW_LOG(
+ @"%s (%p), %s (%p), %s",
+ sel_getName(inOriginalSelector), method_getImplementation(theOriginalMethod),
+ sel_getName(inReplacementSelector), method_getImplementation(theReplacementMethod),
+ (inIsClassMethod ? "YES" : "NO")
+ );
+
+ method_exchangeImplementations(theOriginalMethod, theReplacementMethod);
+}
+
+@end
TruePreview-1.8a3/Source/TruePreview.m
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreviewMessageViewer.h
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewMessageViewer.h (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewMessageViewer.h (revision 67)
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*!
+ * @header
+ * Defines the TruePreviewMessageViewer category for
+ * MessageViewer.
+ * @copyright Copyright (c) 2009-2011 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+ * @version \@(#) $Id: TruePreviewLibraryMessage.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+
+#import "TruePreviewLibraryMessage.h"
+
+/*!
+ * @class
+ * Adds a method for overriding the "mark as viewed" behavior of
+ * MessageViewer.
+ * @version \@(#) $Id: TruePreviewLibraryMessage.h 2 2009-06-27 07:02:45Z jhriggs $
+ * @updated $Date: 2009-06-27 02:02:45 -0500 (Sat, 27 Jun 2009) $
+ */
+@interface TruePreviewMessageViewer : NSObject {
+}
+
+#pragma mark Class methods
+/*! @group Class methods */
+
+/*!
+ * Returns the timers for instances of this class.
+ * @result
+ * The NSMutableDictionary containing the NSTimer
+ * for each instance of this class. The key is an NSNumber
+ * (unsigned long) of the address of each instance.
+ */
++ (NSMutableDictionary*)truePreviewTimers;
+
+#pragma mark Swizzled instance methods
+/*! @group Swizzled instance methods */
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes before
+ * deallocating.
+ */
+- (void)truePreviewDealloc;
+
+/*!
+ * Marks the currently-displayed message as read if configured to do so when
+ * forwarding.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewForwardAsAttachment:(id)inSender;
+
+/*!
+ * Marks the currently-displayed message as read if configured to do so when
+ * forwarding.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewForwardMessage:(id)inSender;
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes when a
+ * message is explicitly marked as read.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewMarkAsRead:(id)inSender;
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes when a
+ * message is explicitly marked as unread.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewMarkAsUnread:(id)inSender;
+
+/*!
+ * Calls truePreviewCreateTimer: to mark the provided message as
+ * read based on the current preferences.
+ * @param inMessage
+ * The message being marked as read.
+ */
+- (void)truePreviewMarkMessageAsViewed:(id)inMessage;
+
+/*!
+ * Calls truePreviewCreateTimer: to mark the provided messages as
+ * read based on the current preferences.
+ * @param inMessage
+ * The NSArray of messages being marked as read.
+ */
+- (void)truePreviewMarkMessagesAsViewed:(NSArray*)inMessages;
+
+/*!
+ * Adds a notification observer to mark the message as viewed when it is
+ * scrolled as appropriate.
+ * @param inNotification
+ * The NSNotification describing the event.
+ */
+- (void)truePreviewMessageWasDisplayedInTextView:(id)inNotification;
+
+/*!
+ * Marks the currently-displayed message as read if configured to do so when
+ * replying.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewReplyAllMessage:(id)inSender;
+
+/*!
+ * Marks the currently-displayed message as read if configured to do so when
+ * replying.
+ * @param inSender
+ * Unused.
+ */
+- (void)truePreviewReplyMessage:(id)inSender;
+
+/*!
+ * Invalidates this instance's timer.
+ */
+- (void)truePreviewSelectedMessagesDidChangeInMessageList;
+
+#pragma mark Accessors
+/*! @group Accessors */
+
+/*!
+ * Returns the timer for this instance.
+ * @result
+ * The NSTimer for this instance.
+ */
+- (NSTimer*)truePreviewTimer;
+
+/*!
+ * Sets the timer for this instance.
+ * @param inTimer
+ * The NSTimer for this instance.
+ */
+- (void)truePreviewSetTimer:(NSTimer*)inTimer;
+
+#pragma mark Instance methods
+/*! @group Instance methods */
+
+/*!
+ * Creates and sets a timer for this instance based on its settings.
+ * @param inMessages
+ * The LibraryMessage or NSArray of messages for
+ * which the timer is being created.
+ */
+- (void)truePreviewCreateTimer:(id)inMessages;
+
+/*!
+ * Invalidates this instance's timer and stops observing scroll changes.
+ */
+- (void)truePreviewReset;
+
+/*!
+ * Marks the currently-displayed message as read.
+ * @param inTimer
+ * Unused.
+ */
+- (void)truePreviewTimerFired:(NSTimer*)inTimer;
+
+/*!
+ * Marks the currently-displayed message as read.
+ * @param inNotification
+ * Unused.
+ */
+- (void)truePreviewMessageClickedOrScrolled:(NSNotification*)inNotification;
+
+@end
TruePreview-1.8a3/Source/TruePreviewMessageViewer.h
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+text/x-c
\ No newline at end of property
Index: TruePreview-1.8a3/Source/TruePreviewPreferences.m
===================================================================
--- TruePreview-1.8a3/Source/TruePreviewPreferences.m (revision 0)
+++ TruePreview-1.8a3/Source/TruePreviewPreferences.m (revision 67)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Christian Serving, L.L.C. nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "TruePreviewPreferences.h"
+
+@implementation TruePreviewPreferences
+
+#pragma mark Swizzled class methods
+
++ (id)truePreviewSharedPreferences {
+ TRUEPREVIEW_LOG();
+
+ static BOOL sAdded = NO;
+ id thePreferences = [NSClassFromString(@"NSPreferences") truePreviewSharedPreferences];
+
+ if ((thePreferences != nil) && !sAdded) {
+ sAdded = YES;
+
+ [[NSClassFromString(@"NSPreferences") truePreviewSharedPreferences]
+ addPreferenceNamed:[TruePreview preferencesPanelName]
+ owner:[TruePreviewPreferencesModule sharedInstance]
+ ];
+ }
+
+ return [NSClassFromString(@"NSPreferences") truePreviewSharedPreferences];
+}
+
+@end
TruePreview-1.8a3/Source/TruePreviewPreferences.m
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Info.plist
===================================================================
--- TruePreview-1.8a3/Info.plist (revision 0)
+++ TruePreview-1.8a3/Info.plist (revision 67)
@@ -0,0 +1,35 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ English
+ CFBundleExecutable
+ ${EXECUTABLE_NAME}
+ CFBundleIconFile
+
+ CFBundleIdentifier
+ org.christianserving.mac.mail.plugin.${PRODUCT_NAME:identifier}
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ ${PRODUCT_NAME}
+ CFBundlePackageType
+ BNDL
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.8a3
+ NSPrincipalClass
+ TruePreview
+ SupportedPluginCompatibilityUUIDs
+
+ 2DE49D65-B49E-4303-A280-8448872EFE87
+ 1146A009-E373-4DB6-AB4D-47E59A7E50FD
+ 6E7970A3-E5F1-4C41-A904-B18D3D8FAA7D
+ EF59EC5E-EFCD-4EA7-B617-6C5708397D24
+ EF59EC5E-EFCD-4EA7-B617-6C5708397D24
+ 4C286C70-7F18-4839-B903-6F2D58FA4C71
+
+
+
Index: TruePreview-1.8a3/headerdoc.make
===================================================================
--- TruePreview-1.8a3/headerdoc.make (revision 0)
+++ TruePreview-1.8a3/headerdoc.make (revision 67)
@@ -0,0 +1,54 @@
+# Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Christian Serving, L.L.C. nor the names of
+# its contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+##
+# headerdoc.make
+# Copyright (c) 2009-2011 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+#
+# @(#) $Id$
+##
+
+SRC_DIR := "$(PROJECT_DIR)/Source"
+HDR_DIR := "$(PROJECT_DIR)/headerdoc"
+TMP_DIR := $(shell mktemp -d -t headerdoc)
+
+HEADERDOC := /usr/bin/headerdoc2html -C -t -u -o $(HDR_DIR)
+GATHERHEADERDOC := /usr/bin/gatherheaderdoc $(TMP_DIR)/headerdoc index.html
+
+DOCS := $(patsubst $(SRC_DIR)/%.h,$(HDR_DIR)/%_h/index.html,$(wildcard $(SRC_DIR)/*.h))
+
+$(HDR_DIR)/index.html : $(DOCS)
+ cp -Rp $(HDR_DIR) $(TMP_DIR)/
+ find $(TMP_DIR)/headerdoc -type d -name '.svn' -exec rm -rf {} +
+ $(GATHERHEADERDOC)
+ cp -R $(TMP_DIR)/headerdoc/ $(HDR_DIR)/
+ rm -rf $(TMP_DIR)
+
+$(DOCS) : $(HDR_DIR)/%_h/index.html : $(SRC_DIR)/%.h
+ $(HEADERDOC) "$?"
TruePreview-1.8a3/headerdoc.make
Property changes :
Added: svn:keywords
## -0,0 +1 ##
+Author Date Revision Id
\ No newline at end of property
Index: TruePreview-1.8a3/Installer/postflight.sh
===================================================================
--- TruePreview-1.8a3/Installer/postflight.sh (revision 0)
+++ TruePreview-1.8a3/Installer/postflight.sh (revision 67)
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# Copyright (c) 2009-2011, Jim Riggs, Christian Serving, L.L.C.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Christian Serving, L.L.C. nor the names of
+# its contributors may be used to endorse or promote products
+# derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+##
+# postflight.sh
+# Copyright (c) 2009-2011 Jim Riggs, Christian Serving, L.L.C. All rights reserved.
+#
+# @(#) $Id$
+##
+
+defaults write "$HOME/Library/Preferences/com.apple.mail" EnableBundles -bool YES
+defaults write "$HOME/Library/Preferences/com.apple.mail" BundleCompatibilityVersion -int 4
+chown "$USER" "$HOME/Library/Preferences/com.apple.mail."*
+chown -R "$USER" "$HOME/Library/Mail/Bundles"
+
+rm -f "/private/tmp/TruePreviewInstallerCurrentUser"
The TruePreviewPreferenceValueTransformerDelay class is the
+subclass of NSValueTransformer that provides a value appropriate
+to display in controls in the TruePreview preferences panel.
+
+
The TruePreviewPreferenceValueTransformer class is the subclass
+of NSValueTransformer that selects the correct radio button in
+the TruePreview preferences panel.
+
+
Returns an NSNumber equivalent to the provided value if the
+value is TRUEPREVIEW_DELAY_IMMEDIATE,
+TRUEPREVIEW_DELAY_DEFAULT,
+TRUEPREVIEW_DELAY_NEVER, or > 0 to
+TRUEPREVIEW_DELAY_MAX; otherwise,
+TRUEPREVIEW_DELAY_DEFAULT is returned.
+
+
The TruePreviewPreferenceValueTransformerDelayEditIndicator
+class is the subclass of NSValueTransformer that indicates
+whether or not delay controls should be enabled in the TruePreview
+preferences panel.
+
+
The Class to which this class's methods should be added.
+
+
+
+Discussion
+
+
Adds the methods from this class to the specified class. This is in essence
+adding a category, but we do it through the objective-c runtime, because of
+the "hiding" of classes in >= 10.6.
+
+
The NSMutableDictionary containing the NSTimer
+for each instance of this class. The key is an NSNumber
+(unsigned long) of the address of each instance.
+
+
+
+Discussion
+
+
Returns the timers for instances of this class.
+
+
Marks the displayed message as viewed, sets a timer to mark the displayed
+message as viewed, and/or adds a notification observer to mark the message as
+viewed when it is scrolled as appropriate.
+
+
The TruePreviewPreferencesModule class is the subclass of
+NSPreferencesModule that displays and manages preferences
+specific to the TruePreview plugin.
+
+