Ignore:
Timestamp:
06/15/07 05:15:03 (13 years ago)
Author:
Nicholas Riley
Message:

ICeCoffEE.m: I was wrong in [319] about the selection extension stuff
being dumb; explain why in code, even though it's not fixed.
Implement some of the same parens support I did in Terminal. Update
for more robust service info dictionary format.

ICeCoffEEServicePrefController.m: Update for more robust service info
dictionary format.

ICeCoffEEServices.[hm]: Renamed from ICeCoffEESetServicesMenu.[hm],
since we do more now. Service info dictionary-creating code now makes
more sense and no longer has naming collision issues.

ICeCoffEEWebKit.m: Some preliminary Safari 3 compatibility stuff, not
quite working yet. An outstanding question - is it better to rely on
"public" WebCore? API or private WebKit? API? So far it seems the
latter is more stable.

English.lproj/APEInfo.rtfd: The Bored Zo has a name: use it. Remove
now-erroneous reference to SimpleText? since TextEdit? support is gone.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEServices.m

    r319 r320  
    11//
    2 //  ICeCoffEESetServicesMenu.m
     2//  ICeCoffEEServices.m
    33//  ICeCoffEE APE
    44//
     
    77//
    88
    9 #import "ICeCoffEESetServicesMenu.h"
     9#import "ICeCoffEEServices.h"
    1010#import "ICeCoffEEShared.h"
    11 
    12 // XXX rename me to something like "ICeCoffEEServicesMenu.m"
    1311
    1412// an approximate clone of HIToolbox's CreateServicesLocalizedDictKey
     
    5755NSDictionary *ICCF_GetServicesInfo(void) {
    5856    NSArray *services = CFServiceControllerCopyServicesEntries();
    59     // NSLog(@"%@", services);
    6057   
    6158    NSEnumerator *e = [services objectEnumerator];
     
    6562        // XXX once tested, redo all this with CF, and no autoreleasing
    6663        // XXX items named the same as submenus (figure out how Cocoa itself does it, too)
    67         // XXX use kICServiceSubmenu (recursion?)
    6864        NSString *itemPath = (NSString *)preferredLocalization((CFDictionaryRef)[serviceEntry objectForKey: @"NSMenuItem"]);
    6965        if (itemPath == nil) continue;
     
    7773        NSMutableDictionary *itemDict = nil;
    7874        while ( (itemComponent = (NSString *)[ce nextObject]) != nil) {
    79             // itemDict is nil if just created
    80             if (itemDict != nil && !bubbledUp) {
    81                 NSString *oldBundlePath = [levelDict objectForKey: (NSString *)kICServiceBundlePath];
     75            // levelDict is nil if just created
     76            if (levelDict != nil && !bubbledUp) {
     77                NSString *oldBundlePath = [itemDict objectForKey: (NSString *)kICServiceBundlePath];
    8278                if ([oldBundlePath isEqualToString: bundlePath])
    8379                    bubbledUp = YES;
    8480                else if (oldBundlePath != nil) {
    8581                    [oldBundlePath retain];
    86                     [levelDict removeObjectForKey: (NSString *)kICServiceBundlePath];
     82                    [itemDict removeObjectForKey: (NSString *)kICServiceBundlePath];
    8783                    NSEnumerator *be = [levelDict objectEnumerator];
    8884                    while ( (itemDict = (NSMutableDictionary *)[be nextObject]) != nil)
     
    9187                }
    9288            }
    93             itemDict = [levelDict objectForKey: itemComponent];
     89            if (levelDict == nil) {
     90                levelDict = [[NSMutableDictionary alloc] init];
     91                [itemDict setObject: levelDict forKey: (NSString *)kICServiceSubmenu];
     92                [levelDict release];
     93                itemDict = nil;
     94            } else {
     95                itemDict = [levelDict objectForKey: itemComponent];
     96            }
    9497            if (itemDict == nil) {
    9598                itemDict = [[NSMutableDictionary alloc] init];
     
    99102                }
    100103                [levelDict setObject: itemDict forKey: itemComponent];
    101                 levelDict = itemDict;
     104                levelDict = nil;
    102105                [itemDict release];
    103                 itemDict = nil;
    104106            } else {
    105                 levelDict = itemDict;
     107                levelDict = [itemDict objectForKey: (NSString *)kICServiceSubmenu];
    106108            }
    107109        }
    108110       
    109111        if (!bubbledUp)
    110             [levelDict setObject: bundlePath forKey: (NSString *)kICServiceBundlePath];
     112            [itemDict setObject: bundlePath forKey: (NSString *)kICServiceBundlePath];
    111113
    112114        NSString *keyEquivalent = (NSString *)preferredLocalization((CFDictionaryRef)[serviceEntry objectForKey: @"NSKeyEquivalent"]);
    113115        if (keyEquivalent == nil) continue;
    114116
    115         [levelDict setObject: keyEquivalent forKey: (NSString *)kICServiceShortcut];
     117        [itemDict setObject: keyEquivalent forKey: (NSString *)kICServiceShortcut];
    116118    }
    117119    [services release];
Note: See TracChangeset for help on using the changeset viewer.