2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include <NGObjWeb/WOApplication.h>
25 @interface WOApplication(DefaultsPrivates)
26 + (NSUserDefaults *)userDefaults;
29 @implementation WOApplication(Defaults)
31 static NSString *ck = nil;
32 static NSString *dk = nil;
34 + (void)setComponentRequestHandlerKey:(NSString *)_key {
37 forKey:@"WOComponentRequestHandlerKey"];
38 [ck release]; ck = nil;
40 + (NSString *)componentRequestHandlerKey {
42 ck = [[[self userDefaults] stringForKey:@"WOComponentRequestHandlerKey"]
47 + (void)setDirectActionRequestHandlerKey:(NSString *)_key {
50 forKey:@"WODirectActionRequestHandlerKey"];
51 [dk release]; dk = nil;
53 + (NSString *)directActionRequestHandlerKey {
55 dk = [[[self userDefaults]
56 stringForKey:@"WODirectActionRequestHandlerKey"] copy];
61 + (void)setResourceRequestHandlerKey:(NSString *)_key {
62 [[self userDefaults] setObject:_key forKey:@"WOResourceRequestHandlerKey"];
64 + (NSString *)resourceRequestHandlerKey {
65 return [[self userDefaults] stringForKey:@"WOResourceRequestHandlerKey"];
68 /* WODefaultSessionTimeOut */
70 + (void)setSessionTimeOut:(NSNumber *)_timeOut {
71 [[self userDefaults] setObject:_timeOut forKey:@"WODefaultSessionTimeOut"];
74 + (NSNumber *)sessionTimeOut {
78 ud = [self userDefaults];
79 // Note: the second check is *intended* (Timeout vs TimeOut), it is
80 // required for compatibility but should be phased out in the
81 // long run. I don't know the proper default-name out of my
82 // head (needs to be checked)
83 o = [ud objectForKey:@"WODefaultSessionTimeout"];
84 if (o == nil) o = [ud objectForKey:@"WODefaultSessionTimeOut"];
85 return [NSNumber numberWithInt:[o intValue]];
88 /* WOCachingEnabled */
90 + (BOOL)isCachingEnabled {
91 return [[[self userDefaults]
92 objectForKey:@"WOCachingEnabled"]
96 /* WODebuggingEnabled */
98 + (BOOL)isDebuggingEnabled {
99 return [[[self userDefaults]
100 objectForKey:@"WODebuggingEnabled"]
104 /* WOCompatibility */
106 static BOOL directConnectEnabled = YES;
108 + (void)setDirectConnectEnabled:(BOOL)_flag {
109 directConnectEnabled = _flag;
111 + (BOOL)isDirectConnectEnabled {
112 return directConnectEnabled;
115 + (void)setCGIAdaptorURL:(NSString *)_url {
116 [[self userDefaults] setObject:_url forKey:@"WOCGIAdaptorURL"];
118 + (NSString *)cgiAdaptorURL {
119 return [[self userDefaults] stringForKey:@"WOCGIAdaptorURL"];
122 /* WOAutoOpenInBrowser */
124 + (void) setAutoOpenInBrowser:(BOOL)_flag {
125 [[self userDefaults] setBool:_flag forKey:@"WOAutoOpenInBrowser"];
127 + (BOOL)autoOpenInBrowser {
128 return [[self userDefaults] boolForKey:@"WOAutoOpenInBrowser"];
131 /* WOApplicationBaseURL */
133 + (void)setApplicationBaseURL:(NSString *)_url {
134 [[self userDefaults] setObject:_url forKey:@"WOApplicationBaseURL"];
136 + (NSString *)applicationBaseURL {
137 return [[self userDefaults] stringForKey:@"WOApplicationBaseURL"];
140 /* WOFrameworksBaseURL */
142 + (void)setFrameworksBaseURL:(NSString *)_url {
143 [[self userDefaults] setObject:_url forKey:@"WOFrameworksBaseURL"];
145 + (NSString *)frameworksBaseURL {
146 return [[self userDefaults] stringForKey:@"WOFrameworksBaseURL"];
149 @end /* WOApplication(Defaults) */