Revision: 6702
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6702&view=rev
Author:   hofman
Date:     2010-08-15 12:34:06 +0000 (Sun, 15 Aug 2010)

Log Message:
-----------
prevent scripting from creating new empty documents

Modified Paths:
--------------
    trunk/SKApplication.m

Modified: trunk/SKApplication.m
===================================================================
--- trunk/SKApplication.m       2010-08-13 15:09:24 UTC (rev 6701)
+++ trunk/SKApplication.m       2010-08-15 12:34:06 UTC (rev 6702)
@@ -44,11 +44,6 @@
 
 NSString *SKApplicationStartsTerminatingNotification = 
@"SKApplicationStartsTerminatingNotification";
 
-...@interface NSApplication (NSApplicationPrivateDeclarations)
-- (id)handleOpenScriptCommand:(NSScriptCommand *)command;
-...@end
-
-
 @implementation SKApplication
 
 @synthesize userAttentionDisabled;
@@ -220,6 +215,15 @@
     [self reorganizeWindowsItem:aWindow];
 }
 
+- (id)newScriptingObjectOfClass:(Class)objectClass forValueForKey:(NSString 
*)key withContentsValue:(id)contentsValue properties:(NSDictionary *)properties 
{
+    if ([key isEqualToString:@"orderedDocuments"]) {
+        [[NSScriptCommand currentCommand] 
setScriptErrorNumber:NSOperationNotSupportedForKeyScriptError];
+        [[NSScriptCommand currentCommand] setScriptErrorString:@"Cannot create 
new empty documents"];
+        return nil;
+    }
+    return [super newScriptingObjectOfClass:objectClass forValueForKey:key 
withContentsValue:contentsValue properties:properties];
+}
+
 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
 - (id <SKApplicationDelegate>)delegate { return 
(<SKApplicationDelegate>)[super delegate]; }
 - (void)setDelegate:(id <SKApplicationDelegate>)newDelegate { [super 
setDelegate:newDelegate]; }


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

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to