2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo 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 OGo 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 OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include <NGObjWeb/WOApplication.h>
26 @interface WOApplication(DefaultsPrivates)
27 + (NSUserDefaults *)userDefaults;
30 @implementation WOApplication(Defaults)
32 static NSString *ck = nil;
33 static NSString *dk = nil;
35 + (void)setComponentRequestHandlerKey:(NSString *)_key {
38 forKey:@"WOComponentRequestHandlerKey"];
39 [ck release]; ck = nil;
41 + (NSString *)componentRequestHandlerKey {
43 ck = [[[self userDefaults] stringForKey:@"WOComponentRequestHandlerKey"]
48 + (void)setDirectActionRequestHandlerKey:(NSString *)_key {
51 forKey:@"WODirectActionRequestHandlerKey"];
52 [dk release]; dk = nil;
54 + (NSString *)directActionRequestHandlerKey {
56 dk = [[[self userDefaults]
57 stringForKey:@"WODirectActionRequestHandlerKey"] copy];
62 + (void)setResourceRequestHandlerKey:(NSString *)_key {
63 [[self userDefaults] setObject:_key forKey:@"WOResourceRequestHandlerKey"];
65 + (NSString *)resourceRequestHandlerKey {
66 return [[self userDefaults] stringForKey:@"WOResourceRequestHandlerKey"];
69 /* WODefaultSessionTimeOut */
71 + (void)setSessionTimeOut:(NSNumber *)_timeOut {
72 [[self userDefaults] setObject:_timeOut forKey:@"WODefaultSessionTimeOut"];
75 + (NSNumber *)sessionTimeOut {
79 ud = [self userDefaults];
80 // Note: the second check is *intended* (Timeout vs TimeOut), it is
81 // required for compatibility but should be phased out in the
82 // long run. I don't know the proper default-name out of my
83 // head (needs to be checked)
84 o = [ud objectForKey:@"WODefaultSessionTimeout"];
85 if (o == nil) o = [ud objectForKey:@"WODefaultSessionTimeOut"];
86 return [NSNumber numberWithInt:[o intValue]];
89 /* WOCachingEnabled */
91 + (BOOL)isCachingEnabled {
92 return [[[self userDefaults]
93 objectForKey:@"WOCachingEnabled"]
97 /* WODebuggingEnabled */
99 + (BOOL)isDebuggingEnabled {
100 return [[[self userDefaults]
101 objectForKey:@"WODebuggingEnabled"]
105 /* WOCompatibility */
107 static BOOL directConnectEnabled = YES;
109 + (void)setDirectConnectEnabled:(BOOL)_flag {
110 directConnectEnabled = _flag;
112 + (BOOL)isDirectConnectEnabled {
113 return directConnectEnabled;
116 + (void)setCGIAdaptorURL:(NSString *)_url {
117 [[self userDefaults] setObject:_url forKey:@"WOCGIAdaptorURL"];
119 + (NSString *)cgiAdaptorURL {
120 return [[self userDefaults] stringForKey:@"WOCGIAdaptorURL"];
123 /* WOAutoOpenInBrowser */
125 + (void) setAutoOpenInBrowser:(BOOL)_flag {
126 [[self userDefaults] setBool:_flag forKey:@"WOAutoOpenInBrowser"];
128 + (BOOL)autoOpenInBrowser {
129 return [[self userDefaults] boolForKey:@"WOAutoOpenInBrowser"];
132 /* WOApplicationBaseURL */
134 + (void)setApplicationBaseURL:(NSString *)_url {
135 [[self userDefaults] setObject:_url forKey:@"WOApplicationBaseURL"];
137 + (NSString *)applicationBaseURL {
138 return [[self userDefaults] stringForKey:@"WOApplicationBaseURL"];
141 /* WOFrameworksBaseURL */
143 + (void)setFrameworksBaseURL:(NSString *)_url {
144 [[self userDefaults] setObject:_url forKey:@"WOFrameworksBaseURL"];
146 + (NSString *)frameworksBaseURL {
147 return [[self userDefaults] stringForKey:@"WOFrameworksBaseURL"];
150 @end /* WOApplication(Defaults) */