Revision: 7462
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7462&view=rev
Author:   hofman
Date:     2011-08-31 09:59:04 +0000 (Wed, 31 Aug 2011)
Log Message:
-----------
local variable for template manager

Modified Paths:
--------------
    trunk/SKMainDocument.m
    trunk/SKNotesDocument.m

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2011-08-30 20:32:48 UTC (rev 7461)
+++ trunk/SKMainDocument.m      2011-08-31 09:59:04 UTC (rev 7462)
@@ -1838,8 +1838,9 @@
         else if ([fileType isEqualToString:@"XDV"])
             normalizedType = SKXDVDocumentType;
         else if ([[self writableTypesForSaveOperation:NSSaveToOperation] 
containsObject:fileType] == NO) {
-            for (NSString *typeName in [[SKTemplateManager sharedManager] 
customTemplateTypes]) {
-                if ([[[SKTemplateManager sharedManager] 
displayNameForTemplateType:fileType] isEqualToString:fileType]) {
+            SKTemplateManager *tm = [SKTemplateManager sharedManager];
+            for (NSString *typeName in [tm customTemplateTypes]) {
+                if ([[tm displayNameForTemplateType:fileType] 
isEqualToString:fileType]) {
                     normalizedType = typeName;
                     break;
                 }

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2011-08-30 20:32:48 UTC (rev 7461)
+++ trunk/SKNotesDocument.m     2011-08-31 09:59:04 UTC (rev 7462)
@@ -826,21 +826,18 @@
     id fileType = [args objectForKey:@"FileType"];
     // we allow template file names without extension
     if (fileType) {
-        NSString *normalizedType = nil;
         if ([[self writableTypesForSaveOperation:NSSaveToOperation] 
containsObject:fileType] == NO) {
-            NSArray *templateTypes = [[SKTemplateManager sharedManager] 
customTemplateTypes];
-            NSArray *templateTypesWithoutExtension = [templateTypes 
valueForKey:@"stringByDeletingPathExtension"];
-            NSUInteger idx = [templateTypesWithoutExtension 
indexOfObject:fileType];
-            if (idx != NSNotFound)
-                normalizedType = [templateTypes objectAtIndex:idx];
+            SKTemplateManager *tm = [SKTemplateManager sharedManager];
+            for (NSString *typeName in [tm customTemplateTypes]) {
+                if ([[tm displayNameForTemplateType:fileType] 
isEqualToString:fileType]) {
+                    NSMutableDictionary *arguments = [[command arguments] 
mutableCopy];
+                    [arguments setObject:typeName forKey:@"FileType"];
+                    [command setArguments:arguments];
+                    [arguments release];
+                    break;
+                }
+            }
         }
-        if (normalizedType) {
-            fileType = normalizedType;
-            NSMutableDictionary *arguments = [[command arguments] mutableCopy];
-            [arguments setObject:fileType forKey:@"FileType"];
-            [command setArguments:arguments];
-            [arguments release];
-        }
     }
     return [super handleSaveScriptCommand:command];
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to