Tomotaka SUWA
t-suw****@users*****
2006年 2月 21日 (火) 23:58:51 JST
Index: AquaSKK/AquaSKKServer.mm diff -u AquaSKK/AquaSKKServer.mm:1.1.2.2 AquaSKK/AquaSKKServer.mm:1.1.2.3 --- AquaSKK/AquaSKKServer.mm:1.1.2.2 Sun Feb 19 13:50:54 2006 +++ AquaSKK/AquaSKKServer.mm Tue Feb 21 23:58:51 2006 @@ -1,5 +1,5 @@ /* -*- objc -*- - $Id: AquaSKKServer.mm,v 1.1.2.2 2006/02/19 04:50:54 t-suwa Exp $ + $Id: AquaSKKServer.mm,v 1.1.2.3 2006/02/21 14:58:51 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -54,8 +54,20 @@ - (void)applicationDidFinishLaunching:(NSNotification*)aNotification { NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + // «Ìzñð[h·é + NSString* error; + NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info]; + NSData* plist = [NSData dataWithContentsOfFile:path]; + NSArray* content = [NSPropertyListSerialization propertyListFromData:plist + mutabilityOption:NSPropertyListImmutable + format:nil errorDescription:&error]; + if(!content) { + NSLog(@"loading plist[%@] failed: %@\n", path, error); + [error release]; + } + // «T[o[ðN®·é - DictionarySet::theInstance().initialize(); + DictionarySet::theInstance().initialize((CFArrayRef)content); // bZ[WnhðN®·é ServerMessageReceiver::start(kAquaSKKServerRunLoopMode); Index: AquaSKK/ChangeLog diff -u AquaSKK/ChangeLog:1.20.2.8 AquaSKK/ChangeLog:1.20.2.9 --- AquaSKK/ChangeLog:1.20.2.8 Sun Feb 19 16:09:11 2006 +++ AquaSKK/ChangeLog Tue Feb 21 23:58:51 2006 @@ -1,3 +1,14 @@ +2006-02-21 Tomotaka SUWA <t.suw****@mac*****> + + * PreferencesController.*: NSArrayController Æ + NSUserDefaultsController ðoCh·éÆAPanther Åâèª é±Æ + ª»¾µ½½ßA«ÌzñðÆ©Ì plist ÉÛ¶/[h·éæ¤ÉC + ³B + + * DictionarySet.*: «Ìzñ©çú»·éæ¤ÉC³B + + * AquaSKKServer.mm: «Ìzñð plist ©ç[h·éæ¤ÉC³B + 2006-02-19 Tomotaka SUWA <t.suw****@mac*****> * Package/scripts/postflight: CXg[ãÉAplist ÌÚsðT|[ Index: AquaSKK/DictionarySet.cpp diff -u AquaSKK/DictionarySet.cpp:1.1.2.2 AquaSKK/DictionarySet.cpp:1.1.2.3 --- AquaSKK/DictionarySet.cpp:1.1.2.2 Sun Feb 19 13:50:54 2006 +++ AquaSKK/DictionarySet.cpp Tue Feb 21 23:58:51 2006 @@ -1,5 +1,5 @@ /* - $Id: DictionarySet.cpp,v 1.1.2.2 2006/02/19 04:50:54 t-suwa Exp $ + $Id: DictionarySet.cpp,v 1.1.2.3 2006/02/21 14:58:51 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -119,13 +119,7 @@ return id.str(); } -void DictionarySet::load() { - CFArrayRef arrayRef = (CFArrayRef)CFPreferencesCopyAppValue(CFSTR("dictionary_info_array"), - kCFPreferencesCurrentApplication); - if(arrayRef == NULL) { - return; - } - +void DictionarySet::load(CFArrayRef arrayRef) { // âîñðNA·é prefs_.clear(); @@ -175,7 +169,6 @@ } CFRelease(dictRef); } - CFRelease(arrayRef); } DictionarySet::DictionarySet() { @@ -193,9 +186,13 @@ return obj; } -void DictionarySet::initialize() { +void DictionarySet::initialize(CFArrayRef arrayRef) { // «ð[h·é - load(); + if(arrayRef) { + CFRetain(arrayRef); + load(arrayRef); + CFRelease(arrayRef); + } } void DictionarySet::terminate() { Index: AquaSKK/DictionarySet.h diff -u AquaSKK/DictionarySet.h:1.1.2.1 AquaSKK/DictionarySet.h:1.1.2.2 --- AquaSKK/DictionarySet.h:1.1.2.1 Sat Feb 18 02:20:38 2006 +++ AquaSKK/DictionarySet.h Tue Feb 21 23:58:51 2006 @@ -1,5 +1,5 @@ /* -*- c++ -*- - $Id: DictionarySet.h,v 1.1.2.1 2006/02/17 17:20:38 t-suwa Exp $ + $Id: DictionarySet.h,v 1.1.2.2 2006/02/21 14:58:51 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -60,7 +60,7 @@ Dictionary* createDictionary(const DictionaryPref& pref) const; std::string generateID(const DictionaryPref& pref) const; - void load(); + void load(CFArrayRef arrayRef); DictionarySet(); ~DictionarySet(); @@ -68,7 +68,7 @@ public: static DictionarySet& theInstance(); - void initialize(); + void initialize(CFArrayRef arrayRef); void terminate(); CppCFString skkserv_style_search(const CppCFString& query); Index: AquaSKK/PreferenceKeys.h diff -u AquaSKK/PreferenceKeys.h:1.1.2.1 AquaSKK/PreferenceKeys.h:1.1.2.2 --- AquaSKK/PreferenceKeys.h:1.1.2.1 Sun Feb 19 13:50:54 2006 +++ AquaSKK/PreferenceKeys.h Tue Feb 21 23:58:51 2006 @@ -1,5 +1,5 @@ /* -*- objc -*- - $Id: PreferenceKeys.h,v 1.1.2.1 2006/02/19 04:50:54 t-suwa Exp $ + $Id: PreferenceKeys.h,v 1.1.2.2 2006/02/21 14:58:51 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -36,10 +36,11 @@ extern NSString* KEY_candidates_window_alpha; extern NSString* KEY_candidates_window_show_after_nth_cand; -extern NSString* KEY_dictionary_info_array; - extern NSString* KEY_skkserv_enabled; extern NSString* KEY_skkserv_port; extern NSString* KEY_skkserv_localonly; +// õ«Ìzñðè`·é plist t@C(z[fBNg©çÌÎpX) +extern NSString* PLIST_dictionary_info; + #endif Index: AquaSKK/PreferencesController.h diff -u AquaSKK/PreferencesController.h:1.6.2.5 AquaSKK/PreferencesController.h:1.6.2.6 --- AquaSKK/PreferencesController.h:1.6.2.5 Sun Feb 19 13:50:54 2006 +++ AquaSKK/PreferencesController.h Tue Feb 21 23:58:51 2006 @@ -1,5 +1,5 @@ /* -*- objc -*- - $Id: PreferencesController.h,v 1.6.2.5 2006/02/19 04:50:54 t-suwa Exp $ + $Id: PreferencesController.h,v 1.6.2.6 2006/02/21 14:58:51 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -21,9 +21,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "DictArrayController.h" + @interface PreferencesController : NSWindowController { IBOutlet NSPopUpButton* kbdLayoutPopUp; IBOutlet NSButton* fontButton; + IBOutlet DictArrayController* dictArray; NSFont* font; NSFontPanel* fontPanel; Index: AquaSKK/PreferencesController.mm diff -u AquaSKK/PreferencesController.mm:1.6.2.7 AquaSKK/PreferencesController.mm:1.6.2.8 --- AquaSKK/PreferencesController.mm:1.6.2.7 Sun Feb 19 13:50:54 2006 +++ AquaSKK/PreferencesController.mm Tue Feb 21 23:58:51 2006 @@ -1,5 +1,5 @@ /* -*- objc -*- - $Id: PreferencesController.mm,v 1.6.2.7 2006/02/19 04:50:54 t-suwa Exp $ + $Id: PreferencesController.mm,v 1.6.2.8 2006/02/21 14:58:51 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -43,12 +43,13 @@ NSString* KEY_candidates_window_alpha = @"candidates_window_alpha"; NSString* KEY_candidates_window_show_after_nth_cand = @"candidates_window_show_after_nth_cand"; -NSString* KEY_dictionary_info_array = @"dictionary_info_array"; - NSString* KEY_skkserv_enabled = @"skkserv_enabled"; NSString* KEY_skkserv_port = @"skkserv_port"; NSString* KEY_skkserv_localonly = @"skkserv_localonly"; +// õ«Ìzñðè`·é plist t@C(z[fBNg©çÌÎpX) +NSString* PLIST_dictionary_info = @"/Library/AquaSKK/DictionarySet.plist"; + // L[{[hCAEgp const NSString* KbdIdKey = @"Identifier"; const NSString* KbdNameKey = @"LocalizedName"; @@ -145,6 +146,20 @@ size:[defaults floatForKey:KEY_candidates_font_size]] retain]; [self setFontButtonTitle:font]; + // «Ìzñð[h·é + NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info]; + NSString* error; + NSData* plist = [NSData dataWithContentsOfFile:path]; + NSMutableArray* content = [NSPropertyListSerialization propertyListFromData:plist + mutabilityOption:NSPropertyListMutableContainersAndLeaves + format:nil errorDescription:&error]; + if(content) { + [dictArray setContent:content]; + } else { + NSLog(@"loading plist failed: %@\n", error); + [error release]; + } + return self; } @@ -162,11 +177,23 @@ [defaults synchronize]; [fontPanel close]; + // «Ìzñð XML `®ÅÛ¶·é + NSString* error; + NSData* plist = [NSPropertyListSerialization dataFromPropertyList:[dictArray content] + format:NSPropertyListXMLFormat_v1_0 errorDescription:&error]; + if(plist) { + NSString* path = [NSHomeDirectory() stringByAppendingPathComponent:PLIST_dictionary_info]; + [plist writeToFile:path atomically:YES]; + } else { + NSLog(@"saving plist failed: %@\n", error); + [error release]; + } + // NCgÉÏXðÊm·é ClientConnectionFactory::theInstance().newConnection().send(kSKKClientConfigurationModified, CppCFData()); // ÄxA«T[o[ðú»·é - DictionarySet::theInstance().initialize(); + DictionarySet::theInstance().initialize((CFArrayRef)[dictArray content]); // skkserv G~ [VÌÄN® skkserv& skkserv = skkserv::theInstance();