Changeset 21292
- Timestamp:
- 10/17/2007 04:28:18 PM (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Plugins/Purple Service/ESPurpleNotifyEmailController.m
r21194 r21292 25 25 @interface ESPurpleNotifyEmailController (PRIVATE) 26 26 + (void)openURLString:(NSString *)urlString; 27 + (void)startMailApplication; 28 + (NSString *)mailApplicationName; 27 29 @end 28 30 … … 165 167 + (void)showNotifyEmailWindowForAccount:(AIAccount *)account withMessage:(NSAttributedString *)inMessage URLString:(NSString *)inURLString 166 168 { 169 NSString *mailApplicationName = [self mailApplicationName]; 167 170 [ESTextAndButtonsWindowController showTextAndButtonsWindowWithTitle:AILocalizedString(@"New Mail",nil) 168 171 defaultButton:nil 169 172 alternateButton:(inURLString ? 170 AILocalizedString(@"Open Mail ",nil) :173 AILocalizedString(@"Open Mail in Browser",nil) : 171 174 nil) 172 otherButton:nil 175 otherButton:((mailApplicationName && [mailApplicationName length]) ? 176 [NSString stringWithFormat:AILocalizedString(@"Launch %@", nil), mailApplicationName] : 177 nil) 173 178 onWindow:nil 174 179 withMessageHeader:nil … … 195 200 196 201 case AITextAndButtonsDefaultReturn: 202 break; 203 197 204 case AITextAndButtonsOtherReturn: 205 if (userInfo) [self startMailApplication]; 206 break; 207 198 208 case AITextAndButtonsClosedWithoutResponse: 199 209 //No action needed … … 202 212 203 213 return YES; 214 } 215 216 /*! 217 * @brief Start mail application from the new mail window 218 * 219 * Launch the user's mail application instead of opening the webmail-page 220 */ 221 + (void)startMailApplication { 222 if ([[NSWorkspace sharedWorkspace] launchApplication:[self mailApplicationName]] == NO) { 223 NSLog(@"Could not launch mail application '%@'", [self mailApplicationName]); 224 } 204 225 } 205 226 … … 251 272 } 252 273 274 /*! 275 * @brief Returns the name of the user's mail application 276 * 277 * Use the LaunchServices to identify the user's mail application and return it's name 278 * @return NSString with the application's name 279 */ 280 + (NSString *)mailApplicationName { 281 NSString *appName; 282 FSRef myAppRef; 283 284 LSGetApplicationForURL((CFURLRef)[NSURL URLWithString:@"mailto://"], kLSRolesAll, &myAppRef, NULL); 285 LSCopyDisplayNameForRef(&myAppRef, (CFStringRef *)&appName); 286 287 return [appName autorelease]; 288 } 289 253 290 @end