Skip to content
Browse files

wanting to switch braches.. trying to sync

  • Loading branch information...
1 parent f04342b commit 59a5a9fca733f55aee5bce11e50e6bb62072a93b @mralexgray committed Apr 6, 2013
View
17 .gitignore
@@ -4,3 +4,20 @@ xcuserdata
.DS_Store
.idea
project.xcworkspace
+CMakeCache
+CMakeFiles
+include
+CMakeCache.txt
+Makefile
+scripts*
+cmake_install.cmake
+example/mac/macExample/macExample/Mailbox.h
+example/mac/macExample/macExample/Mailbox.m
+
+scripts/prepare-icu4c-macos.sh
+
+example/mac/macExample/macExample/Mailbox.h
+
+example/mac/macExample/macExample/Mailbox.m
+
+example/mac/macExample/macExample/Mailbox.m
View
24 example/mac/macExample/macExample.xcodeproj/project.pbxproj
@@ -7,9 +7,10 @@
objects = {
/* Begin PBXBuildFile section */
+ 7B1F29FA17100EE2004A4107 /* AtoZ.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B1F29F917100EE2004A4107 /* AtoZ.framework */; };
C64FF38416AF97F400F8C162 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = C64FF38316AF97F400F8C162 /* main.mm */; };
- C6BD2873170BC5C500A91AC1 /* MCOCIDURLProtocol.mm in Sources */ = {isa = PBXBuildFile; fileRef = C6BD2870170BC5C500A91AC1 /* MCOCIDURLProtocol.mm */; };
- C6BD2874170BC5C500A91AC1 /* MCOMessageView.mm in Sources */ = {isa = PBXBuildFile; fileRef = C6BD2872170BC5C500A91AC1 /* MCOMessageView.mm */; };
+ C6BD2873170BC5C500A91AC1 /* MCOCIDURLProtocol.mm in Sources */ = {isa = PBXBuildFile; fileRef = C6BD2870170BC5C500A91AC1 /* MCOCIDURLProtocol.mm */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
+ C6BD2874170BC5C500A91AC1 /* MCOMessageView.mm in Sources */ = {isa = PBXBuildFile; fileRef = C6BD2872170BC5C500A91AC1 /* MCOMessageView.mm */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
C6BD28B4170BDFE500A91AC1 /* MailCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6BD28B3170BDFE500A91AC1 /* MailCore.framework */; };
C6BD28BA170C14C300A91AC1 /* MCTApplication.mm in Sources */ = {isa = PBXBuildFile; fileRef = C6BD28B9170C14C300A91AC1 /* MCTApplication.mm */; };
C6D42BB616ABB39A002BB4F9 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6D42BB516ABB39A002BB4F9 /* Cocoa.framework */; };
@@ -66,6 +67,9 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 7B1F29F917100EE2004A4107 /* AtoZ.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AtoZ.framework; path = ../../../../../../../../Library/Frameworks/AtoZ.framework; sourceTree = "<group>"; };
+ 7B5E023417108D800086AF70 /* Mailbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mailbox.h; sourceTree = "<group>"; };
+ 7B5E023517108D800086AF70 /* Mailbox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Mailbox.m; sourceTree = "<group>"; };
C64FF38316AF97F400F8C162 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
C6BD286F170BC5C500A91AC1 /* MCOCIDURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOCIDURLProtocol.h; sourceTree = "<group>"; };
C6BD2870170BC5C500A91AC1 /* MCOCIDURLProtocol.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOCIDURLProtocol.mm; sourceTree = "<group>"; };
@@ -95,6 +99,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 7B1F29FA17100EE2004A4107 /* AtoZ.framework in Frameworks */,
C6BD28B4170BDFE500A91AC1 /* MailCore.framework in Frameworks */,
C6D42BE516ABB511002BB4F9 /* WebKit.framework in Frameworks */,
C6D42BB616ABB39A002BB4F9 /* Cocoa.framework in Frameworks */,
@@ -155,6 +160,7 @@
C6D42BA616ABB39A002BB4F9 = {
isa = PBXGroup;
children = (
+ 7B1F29F917100EE2004A4107 /* AtoZ.framework */,
C6BD2876170BC8E200A91AC1 /* MailCore */,
C6BD2875170BC79700A91AC1 /* MailCoreUI */,
C6D42BBB16ABB39A002BB4F9 /* macExample */,
@@ -204,6 +210,8 @@
C6D42BEB16ACFE3F002BB4F9 /* MCTMsgViewController.m */,
C6BD28B8170C14C300A91AC1 /* MCTApplication.h */,
C6BD28B9170C14C300A91AC1 /* MCTApplication.mm */,
+ 7B5E023417108D800086AF70 /* Mailbox.h */,
+ 7B5E023517108D800086AF70 /* Mailbox.m */,
);
path = macExample;
sourceTree = "<group>";
@@ -381,7 +389,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
ONLY_ACTIVE_ARCH = YES;
- SDKROOT = macosx;
+ SDKROOT = "";
};
name = Debug;
};
@@ -403,15 +411,18 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
- SDKROOT = macosx;
+ SDKROOT = "";
};
name = Release;
};
C6D42BD016ABB39A002BB4F9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
+ FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
+ GCC_C_LANGUAGE_STANDARD = "compiler-default";
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/../../../Externals/libetpan/include",
"$(SRCROOT)/../../../Externals/icu4c/include",
@@ -426,6 +437,7 @@
"$(SRCROOT)/../../../Externals/ctemplate/lib",
);
PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -434,7 +446,10 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
+ FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
+ GCC_C_LANGUAGE_STANDARD = "compiler-default";
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/../../../Externals/libetpan/include",
"$(SRCROOT)/../../../Externals/icu4c/include",
@@ -449,6 +464,7 @@
"$(SRCROOT)/../../../Externals/ctemplate/lib",
);
PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = "";
WRAPPER_EXTENSION = app;
};
name = Release;
View
20 example/mac/macExample/macExample/AppDelegate.h
@@ -4,23 +4,21 @@
//
// Created by DINH Viêt Hoà on 1/19/13.
// Copyright (c) 2013 MailCore. All rights reserved.
-//
#import <Cocoa/Cocoa.h>
@class MCTMsgListViewController;
+@interface AppDelegate : NSObject <NSApplicationDelegate>
-@interface AppDelegate : NSObject <NSApplicationDelegate> {
- IBOutlet NSButton * _loginButton;
- IBOutlet NSButton * _cancelButton;
- IBOutlet NSTextField * _loginTextField;
- IBOutlet NSTextField * _passwordTextField;
- IBOutlet NSProgressIndicator * _progressView;
- IBOutlet MCTMsgListViewController * _msgListViewController;
- IBOutlet NSWindow * _accountWindow;
-}
+@property (assign) IBOutlet NSButton *loginButton;
+@property (assign) IBOutlet NSButton *cancelButton;
+@property (assign) IBOutlet NSWindow *accountWindow;
+@property (assign) IBOutlet NSTextField *loginTextField;
+@property (assign) IBOutlet NSTextField *passwordTextField;
+@property (assign) IBOutlet NSProgressIndicator *progressView;
+@property (assign) IBOutlet MCTMsgListViewController *msgListViewController;
-- (IBAction) accountLogin:(id)sender;
+- (IBAction) accountLogin: (id)sender;
- (IBAction) accountCancel:(id)sender;
@end
View
250 example/mac/macExample/macExample/AppDelegate.m
@@ -7,123 +7,193 @@
//
#import "AppDelegate.h"
-
#import <MailCore/MailCore.h>
-
#import "MCTMsgListViewController.h"
@interface AppDelegate () <NSTextFieldDelegate>
-
@end
-@implementation AppDelegate {
- MCOIMAPSession * _session;
- MCOIMAPOperation * _checkOp;
+@implementation AppDelegate { MCOIMAPSession * _session; MCOIMAPOperation * _checkOp; }
+
+- (void) awakeFromNib { _loginTextField.delegate = self;
+ _passwordTextField.delegate = self;
+}
+- (void) applicationDidFinishLaunching:(NSNotification *)aNotification {
+
+ [self _updateState];
+
+ NSString * login = [NSUserDefaults.standardUserDefaults stringForKey:@"Login"];
+ NSString * password = [NSUserDefaults.standardUserDefaults stringForKey:@"Password"];
+
+ !login.length || !password.length ? [_accountWindow makeKeyAndOrderFront:nil] : ^{
+ _loginTextField.stringValue = login;
+ _passwordTextField.stringValue = password; }();
+}
+- (void) accountLogin:(id)sender {
+
+ NSString * login = _loginTextField.stringValue;
+ NSString * password = _passwordTextField.stringValue;
+
+ _session = MCOIMAPSession.new; NSLog(@"try login");
+ _session.hostname = @"imap.gmail.com";
+ _session.port = 993;
+ _session.username = login;
+ _session.password = password;
+ _session.connectionType = MCOConnectionTypeTLS;
+ _checkOp = _session.checkAccountOperation; NSLog(@"start op");
+
+ [_checkOp start:^(NSError * error) { [_accountWindow orderOut:nil];
+
+ [NSUserDefaults.standardUserDefaults setObject:login forKey: @"Login"];
+ [NSUserDefaults.standardUserDefaults setObject:password forKey:@"Password"];
+
+ [_checkOp release]; _checkOp = nil;
+ [_session release]; _session = nil;
+ [self _updateState]; NSLog(@"op done %@", error);
+ [_msgListViewController connect];
+ }];
+
+ [self _updateState];
+}
+- (void) accountCancel:(id)sender {
+
+ [_checkOp cancel]; [_checkOp release];
+ _checkOp = nil; [_session release];
+ _session = nil; [self _updateState];
+}
+- (void) _updateState { _checkOp == nil ?
+
+^{ _loginTextField.enabled = YES;
+ _passwordTextField.enabled = YES;
+ _loginButton.enabled = _loginTextField.stringValue.length
+ && _passwordTextField.stringValue.length;
+ _cancelButton.enabled = NO;
+ [_progressView stopAnimation: nil];
+}():^{
+ _loginTextField.enabled = NO;
+ _passwordTextField.enabled = NO;
+ _loginButton.enabled = NO;
+ _cancelButton.enabled = YES;
+ [_progressView startAnimation:nil];
+}();
}
+- (void) controlTextDidChange:(NSNotification *)aNotification { [self _updateState]; }
-- (void) dealloc
+/*
+// createPopover
+- (void)createPopover
{
- [super dealloc];
+ if (self.myPopover == nil)
+ {
+ // create and setup our popover
+ _myPopover = NSPopover.new;
+
+ // the popover retains us and we retain the popover,
+ // we drop the popover whenever it is closed to avoid a cycle
+ // use a different view controller content if normal vs. HUD appearance
+
+ self.myPopover.contentViewController = popoverViewController;
+ self.myPopover.appearance = NSPopoverAppearanceHUD;
+ self.myPopover.animates = YES;
+
+ // AppKit will close the popover when the user interacts with a user interface element outside the popover.
+ // note that interacting with menus or panels that become key only when needed will not cause a transient popover to close.
+ self.myPopover.behavior = NSPopoverBehaviorTransient;
+
+ // so we can be notified when the popover appears or closes
+ self.myPopover.delegate = self;
+ NSLog(@"created pop : %@", self.myPopover);
+ }
}
-- (void) awakeFromNib
+
+// showPopoverAction:sender
+- (IBAction)showPopoverAction:(id)sender
{
- [_loginTextField setDelegate:self];
- [_passwordTextField setDelegate:self];
+ [self createPopover];
+
+ NSButton *targetButton = (NSButton *)sender;
+
+ // configure the preferred position of the popover
+ NSRectEdge prefEdge = NSMaxXEdge;//_popoverPosition.selectedRow;
+
+ [self.myPopover showRelativeToRect:[_accountWindow.contentView bounds] ofView:_accountWindow.contentView preferredEdge:prefEdge];
}
-- (void) applicationDidFinishLaunching:(NSNotification *)aNotification
+// applicationShouldTerminateAfterLastWindowClosed:sender
+//
+// NSApplication delegate method placed here so the sample conveniently quits
+// after we close the window.
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
- [self _updateState];
-
- NSString * login = [[NSUserDefaults standardUserDefaults] stringForKey:@"Login"];
- NSString * password = [[NSUserDefaults standardUserDefaults] stringForKey:@"Password"];
-
- if (([login length] == 0) || ([password length] == 0)) {
- [_accountWindow makeKeyAndOrderFront:nil];
- }
- else {
- [_loginTextField setStringValue:login];
- [_passwordTextField setStringValue:password];
- }
+ return YES;
}
-- (void) accountLogin:(id)sender
+
+#pragma mark -
+#pragma mark NSPopoverDelegate
+
+// Invoked on the delegate when the NSPopoverWillShowNotification notification is sent.
+// This method will also be invoked on the popover.
+- (void)popoverWillShow:(NSNotification *)notification
{
- NSString * login = [_loginTextField stringValue];
- NSString * password = [_passwordTextField stringValue];
-
- NSLog(@"try login");
- _session = [[MCOIMAPSession alloc] init];
- [_session setHostname:@"imap.gmail.com"];
- [_session setPort:993];
- [_session setUsername:login];
- [_session setPassword:password];
- [_session setConnectionType:MCOConnectionTypeTLS];
- _checkOp = [[_session checkAccountOperation] retain];
- NSLog(@"start op");
- [_checkOp start:^(NSError * error) {
- [_accountWindow orderOut:nil];
-
- NSString * login = [_loginTextField stringValue];
- NSString * password = [_passwordTextField stringValue];
- [[NSUserDefaults standardUserDefaults] setObject:login forKey:@"Login"];
- [[NSUserDefaults standardUserDefaults] setObject:password forKey:@"Password"];
-
- [_checkOp release];
- _checkOp = nil;
- [_session release];
- _session = nil;
-
- [self _updateState];
-
- NSLog(@"op done %@", error);
-
- [_msgListViewController connect];
- }];
-
- [self _updateState];
+ NSPopover *popover = [notification object];
+ NSLog(@"Popopever: %@", popover);
}
-- (void) accountCancel:(id)sender
+// Invoked on the delegate when the NSPopoverDidShowNotification notification is sent.
+// This method will also be invoked on the popover.
+- (void)popoverDidShow:(NSNotification *)notification
{
- [_checkOp cancel];
- [_checkOp release];
- _checkOp = nil;
- [_session release];
- _session = nil;
-
- [self _updateState];
+ NSLog(@"Popopever did show : %@", notification);
+ // add new code here after the popover has been shown
}
-- (void) _updateState
+// Invoked on the delegate when the NSPopoverWillCloseNotification notification is sent.
+// This method will also be invoked on the popover.
+- (void)popoverWillClose:(NSNotification *)notification
{
- if (_checkOp == nil) {
- [_loginTextField setEnabled:YES];
- [_passwordTextField setEnabled:YES];
- NSString * login = [_loginTextField stringValue];
- NSString * password = [_passwordTextField stringValue];
- if (([login length] > 0) && ([password length] > 0)) {
- [_loginButton setEnabled:YES];
- }
- else {
- [_loginButton setEnabled:NO];
- }
- [_cancelButton setEnabled:NO];
- [_progressView stopAnimation:nil];
- }
- else {
- [_loginTextField setEnabled:NO];
- [_passwordTextField setEnabled:NO];
- [_loginButton setEnabled:NO];
- [_cancelButton setEnabled:YES];
- [_progressView startAnimation:nil];
- }
+ NSString *closeReason = [[notification userInfo] valueForKey:NSPopoverCloseReasonKey];
+ if (closeReason)
+ {
+ // closeReason can be:
+ // NSPopoverCloseReasonStandard
+ // NSPopoverCloseReasonDetachToWindow
+ //
+ // add new code here if you want to respond "before" the popover closes
+ //
+ }
}
-- (void) controlTextDidChange:(NSNotification *)aNotification
+// Invoked on the delegate when the NSPopoverDidCloseNotification notification is sent.
+// This method will also be invoked on the popover.
+- (void)popoverDidClose:(NSNotification *)notification
{
- [self _updateState];
+ NSString *closeReason = [[notification userInfo] valueForKey:NSPopoverCloseReasonKey];
+ if (closeReason)
+ {
+ // closeReason can be:
+ // NSPopoverCloseReasonStandard
+ // NSPopoverCloseReasonDetachToWindow
+ //
+ // add new code here if you want to respond "after" the popover closes
+ //
+ }
+
+ _myPopover = nil;
}
+// Invoked on the delegate asked for the detachable window for the popover.
+//- (NSWindow *)detachableWindowForPopover:(NSPopover *)popover
+//{
+// NSWindow *window = detachedWindow;
+// if (popover.appearance == NSPopoverAppearanceHUD)
+// {
+// window = detachedHUDWindow;
+// }
+// return window;
+//}
+*/
+
+
@end
View
6 example/mac/macExample/macExample/MCTApplication.mm
@@ -14,9 +14,9 @@ @implementation MCTApplication
- (void) sendEvent:(NSEvent *)theEvent
{
- mailcore::AutoreleasePool * pool = new mailcore::AutoreleasePool();
- [super sendEvent:theEvent];
- pool->release();
+ mailcore::AutoreleasePool * pool = new mailcore::AutoreleasePool();
+ [super sendEvent:theEvent];
+ pool->release();
}
@end
View
20 example/mac/macExample/macExample/MCTMsgListViewController.h
@@ -7,17 +7,23 @@
//
#import <Cocoa/Cocoa.h>
+#import <AtoZ/AtoZ.h>
#include <MailCore/MailCore.h>
+
+NSString *const kAZLastKnownMessageCount;
+
@class MCTMsgViewController;
+@interface MCTMsgListViewController : NSViewController <NSTableViewDelegate, NSTableViewDataSource>
-@interface MCTMsgListViewController : NSViewController {
- IBOutlet NSTableView * _tableView;
- IBOutlet MCTMsgViewController * _msgViewController;
- MCOIMAPSession * _session;
- MCOIMAPFetchMessagesOperation * _op;
- NSArray * _messages;
-}
+@property (ASS) IBOutlet TUINSView *hostingView;
+@property (ASS) IBOutlet NSTableView *tableView;
+@property (ASS) IBOutlet MCTMsgViewController *msgViewController;
+@property (strong) TUIView *rootView;
+@property (strong) MCOIMAPSession *session;
+@property (strong) MCOIMAPFetchMessagesOperation *op;
+@property (strong) NSMutableArray *messages;
+@property (strong) TUIProgressBar *progress;
- (void) connect;
View
238 example/mac/macExample/macExample/MCTMsgListViewController.m
@@ -7,81 +7,207 @@
//
#import "MCTMsgListViewController.h"
-
-#include <MailCore/MailCore.h>
-
#import "MCTMsgViewController.h"
-#define FOLDER @"INBOX"
-
-@interface MCTMsgListViewController () <NSTableViewDelegate, NSTableViewDataSource>
+@interface UnreadStatusCell : NSActionCell
+@end
+@interface TUIButtonBlock :TUIButton
+@end
+@implementation TUIButtonBlock
+//- (void) drawTitle:(CGRect)rect {}
+// NSRectFillWithColor(self.frame, GREEN);
+// [[[self titleForState:TUIControlStateNormal] attributedWithFont:AtoZ.controlFont andColor:RED] drawInRect:self.frame];
+//- (TUIButtonType)buttonType { NSD* buttonTypes = @{ @"TUIButtonTypeCustom" : @(TUIButtonTypeCustom),
+// @"TUIButtonTypeStandard" : @(TUIButtonTypeStandard),
+// @"TUIButtonTypeRectangular" : @(TUIButtonTypeRectangular),
+// @"TUIButtonTypeCircular" : @(TUIButtonTypeCircular),
+// @"TUIButtonTypeTextured" : @(TUIButtonTypeTextured),
+// @"TUIButtonTypeMinimal" : @(TUIButtonTypeMinimal),
+// @"TUIButtonTypeInline" : @(TUIButtonTypeInline) };
+//
+// return self._buttonFlags->buttonType == NSNotFound ? _buttonFlags->buttonType : [buttonTypes.allValues.randomElement integerValue];
+//}
@end
+NSString * const kAZLastKnownMessageCount = @"lastKnownMassgeCount";
+
+#define FOLDER @"INBOX"
+
@implementation MCTMsgListViewController
- (void) awakeFromNib
{
- [self connect];
+
+ NSUI statusCol = [_tableView columnWithIdentifier: @"status"];
+ ((NSTC*)_tableView.tableColumns[statusCol]).dataCell = [UnreadStatusCell new];
+// [[_tableView.tableColumns arrayByRemovingFirstObject] each:^(NSTC* obj) {
+// [obj.dataCell setDrawsBackground:YES];
+// [obj.dataCell setBackgroundColor:[GRAY1 colorWithNoiseWithOpacity:.04]];
+// }];
+
+
+
+ _rootView = [TUIView.alloc initWithFrame:_hostingView.bounds];
+ _hostingView.rootView = _rootView;
+ _rootView.backgroundColor = [GRAY1 colorWithNoiseWithOpacity:.1];
+ NSR l = AZRectTrimmedOnRight(_hostingView.frame, 100);
+ NSR r = AZRectTrimmedOnLeft( _hostingView.frame, _hostingView.width - 100);
+ r.origin.x -= 22;
+ r.size.width = 100;
+ r.size.height = .5 * _hostingView.height;
+ r.origin.y = .23 * _hostingView.height;
+ _progress = [TUIProgressBar.alloc initWithFrame:r style:TUIProgressBarStyleGray];
+ _progress.autoresizingMask = TUIViewAutoresizingFlexibleLeftMargin;
+ [_rootView addSubview:_progress];
+ _progress.indeterminate = YES;
+
+// CGF buttonW = l.size.width/buttonTypes.count;
+// [buttonTypes eachWithIndex:^(id key, id value, NSUInteger idx, BOOL *stop) {
+ TUIButtonBlock *b = [TUIButtonBlock buttonWithType:TUIButtonTypeMinimal];
+ b.frame = AZRectBy(100, l.size.height);
+ [b setTitle:NSS.randomWord forState:TUIControlStateNormal];
+ [b addTarget:AZSHAREDAPP.delegate action:@selector(showPopoverAction:) forControlEvents:TUIControlEventMouseUpInside];
+
+// b.frame = (NSR) { idx * buttonW, 0,buttonW, _rootView.height};
+ [_rootView addSubview: b];
+// }];
+
+ [self connect];
+
}
- (void) connect
{
- [_msgViewController setFolder:FOLDER];
-
- NSString * login = [[NSUserDefaults standardUserDefaults] stringForKey:@"Login"];
- NSString * password = [[NSUserDefaults standardUserDefaults] stringForKey:@"Password"];
- if (([login length] == 0) || ([password length] == 0))
- return;
-
- _session = [[MCOIMAPSession alloc] init];
- [_session setHostname:@"imap.gmail.com"];
- [_session setPort:993];
- [_session setUsername:login];
- [_session setPassword:password];
- [_session setConnectionType:MCOConnectionTypeTLS];
-
- MCOIMAPMessagesRequestKind requestKind = (MCOIMAPMessagesRequestKind)
- (MCOIMAPMessagesRequestKindHeaders | MCOIMAPMessagesRequestKindStructure |
- MCOIMAPMessagesRequestKindInternalDate | MCOIMAPMessagesRequestKindHeaderSubject |
- MCOIMAPMessagesRequestKindFlags);
-
- _op = [_session fetchMessagesByUIDOperationWithFolder:FOLDER requestKind:requestKind uids:[MCOIndexSet indexSetWithRange:MCORangeMake(1, UINT64_MAX)]];
- [_op setProgress:^(unsigned int current){
- //NSLog(@"progress: %u", current);
- }];
- [_op start:^(NSError * error, NSArray * messages, MCOIndexSet * vanishedMessages) {
- [_messages release];
- _messages = [messages retain];
- NSLog(@"%i messages", (int) [_messages count]);
- //NSLog(@"%@", _messages);
- [_tableView reloadData];
- }];
+ _msgViewController.folder = FOLDER;
+ NSS * login = [AZUSERDEFS stringForKey:@"Login"];
+ NSS * password = [AZUSERDEFS stringForKey:@"Password"];
+
+ if (!login.length || !password.length)return;
+
+ _session = MCOIMAPSession.new;
+ _session.hostname = @"imap.gmail.com";
+ _session.port = 993;
+ _session.username = login;
+ _session.password = password;
+ _session.connectionType = MCOConnectionTypeTLS;
+
+ MCOIMAPMessagesRequestKind requestKind =
+ (MCOIMAPMessagesRequestKind) ( MCOIMAPMessagesRequestKindHeaders |
+ MCOIMAPMessagesRequestKindStructure |
+ MCOIMAPMessagesRequestKindInternalDate |
+ MCOIMAPMessagesRequestKindHeaderSubject |
+ MCOIMAPMessagesRequestKindFlags );
+
+ MCOIndexSet *set = [MCOIndexSet indexSetWithRange:MCORangeMake(1, UINT64_MAX)];
+
+ _op = [_session fetchMessagesByUIDOperationWithFolder:FOLDER
+ requestKind:requestKind
+ uids:set];
+
+ [_op setProgress:^(unsigned int current){
+ NSI lastCt = [AZUSERDEFS integerForKey:kAZLastKnownMessageCount] ?: -1;
+ NSLog(@"progress: %u / %ld", current, lastCt);
+// self.progress.indeterminate = lastCt == -1;
+// if (lastCt != -1) _progress.progress = (current / lastCt);
+ }];
+ [_op start:^(NSError * error, NSArray * messages, MCOIndexSet * vanishedMessages) {
+ [_messages release];
+ _messages = messages.mutableCopy;
+ NSLog(@"%i messages", (int) _messages.count);
+ [AZUSERDEFS setObject:@(_messages.count) forKey:kAZLastKnownMessageCount];
+ //NSLog(@"%@", _messages);
+ [_tableView reloadData];
+ }];
}
-- (NSInteger) numberOfRowsInTableView:(NSTableView *)aTableView
-{
- return [_messages count];
+#define AZTBL_ROWSINaTV numberOfRowsInTableView:(NSTV*)aTV
+#define AZTBL_aTVaTCrow tableView:(NSTV*)aTV objectValueForTableColumn:(NSTC*)aTC row:(NSI)row
+#define AZTBL_TBLSELnot tableViewSelectionDidChange:(NSNOT*)not
+#define AZTBL_aTVSRTold tableView:(NSTV*)aTV sortDescriptorsDidChange:(NSA*)old
+#define AZTBL_aTVCLKaTC tableView:(NSTV*)aTV didClickTableColumn:(NSTC*)aTC
+
+- (NSI) AZTBL_ROWSINaTV { return _messages.count; }
+- (id) AZTBL_aTVaTCrow {
+
+ MCOIMAPMessage *msg = _messages[row];
+ MCOMessageFlag flag = msg.flags;
+ MCOAddress *sender = msg.header.sender;
+
+ return areSame(aTC.identifier,@"status") ? @(flag)
+ : areSame(aTC.identifier, @"date") ? msg.header.date
+ : areSame(aTC.identifier,@"sender") ? sender.displayName
+ : msg.header.subject;
}
+- (void) AZTBL_TBLSELnot {
+
+ __block MCOIMAPMessage *active;
+ BOOL negIdx = ((int)_tableView.selectedRow) == -1;
+ _msgViewController.session = negIdx ? nil
+ : _session;
+ _msgViewController.message = negIdx ? nil
+ /* MCOIMAPMessage* */ : ^{ return active = _messages[_tableView.selectedRow]; }();
+
+// NSLog(@"selected Rows: %@ Cols: %@", _tableView.selectedRowIndexes, _tableView.selectedColumnIndexes);
+// MCOMessageFlag d = MCOMessageFlagAnswered;
+// [active setFlags: d];
+// [_tableView reloadDataForRowIndexes:[_tableView selectedRowIndexes] columnIndexes:[NSIndexSet.alloc initWithIndex:0]];
+// [RBLPopover showRelativeTo:[_tableView rectOfRow:_tableView.selectedRow]
+// ofView:_tableView
+// edge:NSMaxXEdge
+// string:active.header.sender.displayName bg:RANDOMCOLOR size:NSMakeSize(250,250)];
+
-- (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
-{
- MCOIMAPMessage * msg = [_messages objectAtIndex:rowIndex];
- return [[msg header] subject];
}
+/*
+- (void) AZTBL_aTVCLKaTC { // Either reverse the sort or change the sorting column }
+
+
+ NSArray *newDescriptors = [aTV sortDescriptors];
+ [_messages sortUsingDescriptors:newDescriptors];
+ NSLog(@"%@, %@", newDescriptors, _messages );
+ //"results" is my NSMutableArray which is set to be the data source for the NSTableView object.
+ [aTV reloadData];
+}
+
+- (NSCell*) tableView:(NSTV*)aTV dataCellForTableColumn:(NSTC*)aTC row:(NSI)row {
+
+ static NSD* colors = nil; colors = @{ @"date": GRAY2, @"subject" : RED, @"sender":BLACK };
+ static NSF* font = nil; font = [AtoZ.controlFont fontWithSize:14];
+ if ( !areSame(aTC.identifier, @"status")) {
+
+ [aTC.dataCell setTextColor: colors[aTC.identifier]];
+ [aTC.dataCell setFont:font];
+ }
+ return aTC.dataCell;
+}
+
+
+*/
+//- (void)tableView:(NSTV*)aTV willDisplayCell:(id)cell forTableColumn:(NSTC*)aTC row:(NSI)row
+//{
+// if ( !areSame(aTC.identifier, @"status")) {
+// [cell setBackgroundColor:RANDOMCOLOR];
+// }
+//}
+
+//
+// [_messages sortedArrayByKeyPaths:@"header.date"];
+//// [aTV.selectedColumnIndexes.firstIndex]];
+// // sortUsingDescriptors:aTV.sortDescriptors];
+// [aTV reloadData];
+//}
+
+@end
+
+@implementation UnreadStatusCell
+
+- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
+
+ NSColor*flag = [self.objectValue integerValue] == MCOMessageFlagSeen ? BLUE : RED;
+ NSRectFillWithColor(cellFrame, flag);
-- (void) tableViewSelectionDidChange:(NSNotification *)notification
-{
- int rowIndex = (int) [_tableView selectedRow];
- if (rowIndex == -1) {
- [_msgViewController setSession:nil];
- [_msgViewController setMessage:nil];
- }
- else {
- MCOIMAPMessage * msg = [_messages objectAtIndex:rowIndex];
- [_msgViewController setSession:_session];
- [_msgViewController setMessage:msg];
- }
}
@end
+
View
24 example/mac/macExample/macExample/MCTMsgViewController.h
@@ -7,27 +7,23 @@
//
#import <Cocoa/Cocoa.h>
-
#include <MailCore/MailCore.h>
+#import "MCOMessageView.h"
@class MCOMessageView;
@class MCOIMAPAsyncSession;
@class MCOMAPMessage;
-@interface MCTMsgViewController : NSViewController {
- IBOutlet MCOMessageView * _messageView;
- NSMutableDictionary * _storage;
- NSMutableSet * _pending;
- NSMutableArray * _ops;
- MCOIMAPSession * _session;
- MCOIMAPMessage * _message;
- NSMutableDictionary * _callbacks;
- NSString * _folder;
-}
+@interface MCTMsgViewController : NSViewController <MCOMessageViewDelegate>
-@property (nonatomic, copy) NSString * folder;
+@property (assign) IBOutlet MCOMessageView *messageView;
+@property (strong) NSMutableDictionary *storage;
+@property (strong) NSMutableSet *pending;
+@property (strong) NSMutableArray *messages, *ops;
+@property (strong) NSMutableDictionary *callbacks;
-@property (nonatomic, strong) MCOIMAPSession * session;
-@property (nonatomic, strong) MCOIMAPMessage * message;
+@property (nonatomic, copy) NSString * folder;
+@property (nonatomic,strong) MCOIMAPSession *session;
+@property (nonatomic,strong) MCOIMAPMessage *message;
@end
View
346 example/mac/macExample/macExample/MCTMsgViewController.m
@@ -8,117 +8,80 @@
#import "MCTMsgViewController.h"
-#import "MCOMessageView.h"
-
-@interface MCTMsgViewController () <MCOMessageViewDelegate>
-
-@end
@implementation MCTMsgViewController
+@synthesize message = _message;
-@synthesize folder = _folder;
-@synthesize session = _session;
-
-- (void) awakeFromNib
-{
- _storage = [[NSMutableDictionary alloc] init];
- _ops = [[NSMutableArray alloc] init];;
- _pending = [[NSMutableSet alloc] init];;
- _callbacks = [[NSMutableDictionary alloc] init];
+- (void) awakeFromNib {
+ _pending = NSMutableSet.new;
+ _storage = NSMutableDictionary.new;
+ _callbacks = NSMutableDictionary.new;
+ _ops = NSMutableArray.new;
}
-
-- (void) setMessage:(MCOIMAPMessage *)message
-{
- NSLog(@"set message : %@", message);
- for(MCOOperation * op in _ops) {
- [op cancel];
- }
- [_ops removeAllObjects];
-
- [_callbacks removeAllObjects];
- [_pending removeAllObjects];
- [_storage removeAllObjects];
- [_message release];
- _message = [message retain];
-
- if (![[NSUserDefaults standardUserDefaults] boolForKey:@"FetchFullMessageEnabled"]) {
- [_messageView setDelegate:self];
- [_messageView setFolder:_folder];
- [_messageView setMessage:message];
- }
- else {
- [_messageView setMessage:NULL];
- MCOIMAPFetchContentOperation * op = [_session fetchMessageByUIDOperationWithFolder:_folder uid:[_message uid]];
- [_ops addObject:op];
- [op start:^(NSError * error, NSData * data) {
- if ([error code] != MCOErrorNone) {
- return;
- }
-
- NSAssert(data != nil, @"data != nil");
-
- MCOMessageParser * msg = [MCOMessageParser messageParserWithData:data];
- [_messageView setDelegate:self];
- [_messageView setFolder:_folder];
- [_messageView setMessage:msg];
- }];
- }
+- (void) setMessage:(MCOIMAPMessage *)message {
+ for(MCOOperation * op in _ops) [op cancel]; NSLog(@"set message : %@", message);
+ [_ops removeAllObjects];
+ [_callbacks removeAllObjects];
+ [_pending removeAllObjects];
+ [_storage removeAllObjects];
+ _message = message;
+
+ if (![NSUserDefaults.standardUserDefaults boolForKey:@"FetchFullMessageEnabled"]) {
+ _messageView.delegate = self;
+ _messageView.folder = _folder;
+ _messageView.message = message;
+ } else {
+ _messageView.message = NULL;
+ MCOIMAPFetchContentOperation * op = [_session fetchMessageByUIDOperationWithFolder:_folder uid:_message.uid];
+ [_ops addObject:op];
+ [op start:^(NSError * error, NSData * data) { if ([error code] != MCOErrorNone) return;
+ NSAssert(data != nil, @"data != nil");
+
+ MCOMessageParser * msg = [MCOMessageParser messageParserWithData:data];
+ _messageView.delegate = self;
+ _messageView.folder = _folder;
+ _messageView.message = msg;
+ }];
+ }
}
-
-- (MCOIMAPMessage *) message
-{
- return _message;
-}
-
-- (MCOIMAPFetchContentOperation *) _fetchIMAPPartWithUniqueID:(NSString *)partUniqueID folder:(NSString *)folder
-{
- NSLog(@"%@ is missing, fetching", partUniqueID);
-
- if ([_pending containsObject:partUniqueID]) {
- return NULL;
- }
-
- MCOIMAPPart * part = (MCOIMAPPart *) [_message partForUniqueID:partUniqueID];
- NSAssert(part != nil, @"part != nil");
-
- [_pending addObject:partUniqueID];
-
- MCOIMAPFetchContentOperation * op = [_session fetchMessageAttachmentByUIDOperationWithFolder:folder uid:[_message uid] partID:[part partID] encoding:[part encoding]];
- [_ops addObject:op];
- [op start:^(NSError * error, NSData * data) {
- if ([error code] != MCOErrorNone) {
- [self _callbackForPartUniqueID:partUniqueID error:error];
- return;
- }
-
- NSAssert(data != NULL, @"data != nil");
- [_ops removeObject:op];
- [_storage setObject:data forKey:partUniqueID];
- [_pending removeObject:partUniqueID];
- NSLog(@"downloaded %@", partUniqueID);
-
- [self _callbackForPartUniqueID:partUniqueID error:nil];
- }];
-
- return op;
+- (MCOIMAPFetchContentOperation *) _fetchIMAPPartWithUniqueID:(NSString*)partUniqueID folder:(NSString*)folder {
+
+ NSLog(@"%@ is missing, fetching", partUniqueID);
+ if ([_pending containsObject:partUniqueID]) return NULL;
+
+ MCOIMAPPart * part = (MCOIMAPPart *) [_message partForUniqueID:partUniqueID];
+ NSAssert(part != nil, @"part != nil");
+ [_pending addObject:partUniqueID];
+
+ MCOIMAPFetchContentOperation * op = [_session fetchMessageAttachmentByUIDOperationWithFolder:folder
+ uid:_message.uid partID:part.partID encoding:part.encoding];
+ [_ops addObject:op];
+
+ [op start:^(NSError * error, NSData * data) {
+
+ if ([error code] != MCOErrorNone) { [self _callbackForPartUniqueID:partUniqueID error:error]; return; }
+
+ NSAssert(data != NULL, @"data != nil");
+ [_ops removeObject:op];
+ [_storage setObject:data forKey:partUniqueID];
+ [_pending removeObject:partUniqueID]; NSLog(@"downloaded %@", partUniqueID);
+ [self _callbackForPartUniqueID:partUniqueID error:nil];
+ }];
+
+ return op;
}
typedef void (^DownloadCallback)(NSError * error);
-- (void) _callbackForPartUniqueID:(NSString *)partUniqueID error:(NSError *)error
-{
- NSArray * blocks;
- blocks = [_callbacks objectForKey:partUniqueID];
- NSLog(@"%@", blocks);
- for(DownloadCallback block in blocks) {
- block(error);
- }
- NSLog(@"done: %@", blocks);
+- (void) _callbackForPartUniqueID:(NSString *)partUniqueID error:(NSError *)error {
+ NSArray * blocks = [_callbacks objectForKey:partUniqueID]; NSLog(@"%@", blocks);
+
+ for(DownloadCallback block in blocks) { block(error); } NSLog(@"done: %@", blocks);
}
- (NSString *) MCOMessageView_templateForAttachment:(MCOMessageView *)view
{
- return @"<div><img src=\"http://www.iconshock.com/img_jpg/OFFICE/general/jpg/128/attachment_icon.jpg\"/></div>\
+ return @"<div><img src=\"http://www.iconshock.com/img_jpg/OFFICE/general/jpg/128/attachment_icon.jpg\"/></div>\
{{#HASSIZE}}\
<div>- {{FILENAME}}, {{SIZE}}</div>\
{{/HASSIZE}}\
@@ -129,127 +92,126 @@ - (NSString *) MCOMessageView_templateForAttachment:(MCOMessageView *)view
- (NSString *) MCOMessageView_templateForMessage:(MCOMessageView *)view
{
- return @"<div style=\"padding-bottom: 20px; font-family: Helvetica; font-size: 13px;\">{{HEADER}}</div><div>{{BODY}}</div>";
+ return @"<div style=\"padding-bottom: 20px; font-family: Helvetica; font-size: 13px;\">{{HEADER}}</div><div>{{BODY}}</div>";
}
- (BOOL) MCOMessageView:(MCOMessageView *)view canPreviewPart:(MCOAbstractPart *)part
{
- // tiff, tif, pdf
- NSString * mimeType = [[part mimeType] lowercaseString];
- if ([mimeType isEqualToString:@"image/tiff"]) {
- return YES;
- }
- else if ([mimeType isEqualToString:@"image/tif"]) {
- return YES;
- }
- else if ([mimeType isEqualToString:@"application/pdf"]) {
- return YES;
- }
-
- NSString * ext = nil;
- if ([part filename] != nil) {
- if ([[part filename] pathExtension] != nil) {
- ext = [[[part filename] pathExtension] lowercaseString];
- }
- }
- if (ext != nil) {
- if ([ext isEqualToString:@"tiff"]) {
- return YES;
- }
- else if ([ext isEqualToString:@"tif"]) {
- return YES;
- }
- else if ([ext isEqualToString:@"pdf"]) {
- return YES;
- }
- }
-
- return NO;
+ // tiff, tif, pdf
+ NSString * mimeType = [[part mimeType] lowercaseString];
+ if ([mimeType isEqualToString:@"image/tiff"]) {
+ return YES;
+ }
+ else if ([mimeType isEqualToString:@"image/tif"]) {
+ return YES;
+ }
+ else if ([mimeType isEqualToString:@"application/pdf"]) {
+ return YES;
+ }
+
+ NSString * ext = nil;
+ if ([part filename] != nil) {
+ if ([[part filename] pathExtension] != nil) {
+ ext = [[[part filename] pathExtension] lowercaseString];
+ }
+ }
+ if (ext != nil) {
+ if ([ext isEqualToString:@"tiff"]) {
+ return YES;
+ }
+ else if ([ext isEqualToString:@"tif"]) {
+ return YES;
+ }
+ else if ([ext isEqualToString:@"pdf"]) {
+ return YES;
+ }
+ }
+
+ return NO;
}
- (NSString *) MCOMessageView:(MCOMessageView *)view filteredHTML:(NSString *)html
{
- return html;
+ return html;
}
- (NSData *) MCOMessageView:(MCOMessageView *)view dataForPartWithUniqueID:(NSString *)partUniqueID
{
- NSData * data = [_storage objectForKey:partUniqueID];
- return data;
+ NSData * data = [_storage objectForKey:partUniqueID];
+ return data;
}
- (void) MCOMessageView:(MCOMessageView *)view fetchDataForPartWithUniqueID:(NSString *)partUniqueID
- downloadedFinished:(void (^)(NSError * error))downloadFinished
+ downloadedFinished:(void (^)(NSError * error))downloadFinished
{
- MCOIMAPFetchContentOperation * op = [self _fetchIMAPPartWithUniqueID:partUniqueID folder:_folder];
- [op setProgress:^(unsigned int current, unsigned int maximum) {
- NSLog(@"progress content: %u/%u", current, maximum);
- }];
- [_ops addObject:op];
- if (downloadFinished != NULL) {
- NSMutableArray * blocks;
- blocks = [_callbacks objectForKey:partUniqueID];
- if (blocks == nil) {
- blocks = [NSMutableArray array];
- [_callbacks setObject:blocks forKey:partUniqueID];
- }
- [blocks addObject:[[downloadFinished copy] autorelease]];
- }
+ MCOIMAPFetchContentOperation * op = [self _fetchIMAPPartWithUniqueID:partUniqueID folder:_folder];
+ [op setProgress:^(unsigned int current, unsigned int maximum) {
+ NSLog(@"progress content: %u/%u", current, maximum);
+ }];
+ [_ops addObject:op];
+ if (downloadFinished != NULL) {
+ NSMutableArray * blocks;
+ blocks = [_callbacks objectForKey:partUniqueID];
+ if (blocks == nil) {
+ blocks = [NSMutableArray array];
+ [_callbacks setObject:blocks forKey:partUniqueID];
+ }
+ [blocks addObject:[downloadFinished copy]];
+ }
}
- (NSData *) MCOMessageView:(MCOMessageView *)view previewForData:(NSData *)data isHTMLInlineImage:(BOOL)isHTMLInlineImage
{
- if (isHTMLInlineImage) {
- return data;
- }
- else {
- return [self _convertToJPEGData:data];
- }
+ if (isHTMLInlineImage) {
+ return data;
+ }
+ else {
+ return [self _convertToJPEGData:data];
+ }
}
#define IMAGE_PREVIEW_HEIGHT 300
#define IMAGE_PREVIEW_WIDTH 500
- (NSData *) _convertToJPEGData:(NSData *)data
{
- CGImageSourceRef imageSource;
- CGImageRef thumbnail;
- NSMutableDictionary * info;
- int width;
- int height;
- float quality;
-
- width = IMAGE_PREVIEW_WIDTH;
- height = IMAGE_PREVIEW_HEIGHT;
- quality = 1.0;
-
- imageSource = CGImageSourceCreateWithData((CFDataRef) data, NULL);
- if (imageSource == NULL)
- return nil;
-
- info = [[NSMutableDictionary alloc] init];
- [info setObject:(id) kCFBooleanTrue forKey:(id) kCGImageSourceCreateThumbnailWithTransform];
- [info setObject:(id) kCFBooleanTrue forKey:(id) kCGImageSourceCreateThumbnailFromImageAlways];
- [info setObject:(id) [NSNumber numberWithFloat:(float) IMAGE_PREVIEW_WIDTH] forKey:(id) kCGImageSourceThumbnailMaxPixelSize];
- thumbnail = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, (CFDictionaryRef) info);
- [info release];
-
- CGImageDestinationRef destination;
- NSMutableData * destData = [NSMutableData data];
-
- destination = CGImageDestinationCreateWithData((CFMutableDataRef) destData,
- (CFStringRef) @"public.jpeg",
- 1, NULL);
-
- CGImageDestinationAddImage(destination, thumbnail, NULL);
- CGImageDestinationFinalize(destination);
-
- CFRelease(destination);
-
- CFRelease(thumbnail);
- CFRelease(imageSource);
-
- return destData;
+ CGImageSourceRef imageSource;
+ CGImageRef thumbnail;
+ NSMutableDictionary * info;
+ int width;
+ int height;
+ float quality;
+
+ width = IMAGE_PREVIEW_WIDTH;
+ height = IMAGE_PREVIEW_HEIGHT;
+ quality = 1.0;
+
+ imageSource = CGImageSourceCreateWithData((__bridge CFDataRef) data, NULL);
+ if (imageSource == NULL)
+ return nil;
+
+ info = [[NSMutableDictionary alloc] init];
+ [info setObject:(id) kCFBooleanTrue forKey:(id) kCGImageSourceCreateThumbnailWithTransform];
+ [info setObject:(id) kCFBooleanTrue forKey:(id) kCGImageSourceCreateThumbnailFromImageAlways];
+ [info setObject:(id) [NSNumber numberWithFloat:(float) IMAGE_PREVIEW_WIDTH] forKey:(id) kCGImageSourceThumbnailMaxPixelSize];
+ thumbnail = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, (__bridge CFDictionaryRef) info);
+
+ CGImageDestinationRef destination;
+ NSMutableData * destData = [NSMutableData data];
+
+ destination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef) destData,
+ (CFStringRef) @"public.jpeg",
+ 1, NULL);
+
+ CGImageDestinationAddImage(destination, thumbnail, NULL);
+ CGImageDestinationFinalize(destination);
+
+ CFRelease(destination);
+
+ CFRelease(thumbnail);
+ CFRelease(imageSource);
+
+ return destData;
}
@end
View
2,016 example/mac/macExample/macExample/en.lproj/MainMenu.xib
1,606 additions, 410 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
8 example/mac/macExample/macExample/main.mm
@@ -12,8 +12,8 @@
int main(int argc, char *argv[])
{
- u_setDataDirectory("/usr/local/share/icu");
- mailcore::AutoreleasePool * pool = new mailcore::AutoreleasePool();
- return NSApplicationMain(argc, (const char **)argv);
- pool->release();
+ u_setDataDirectory("/usr/local/share/icu");
+ mailcore::AutoreleasePool * pool = new mailcore::AutoreleasePool();
+ return NSApplicationMain(argc, (const char **)argv);
+ pool->release();
}

0 comments on commit 59a5a9f

Please sign in to comment.
Something went wrong with that request. Please try again.