- Inherits From:
- NSObject
- Declared In:
- GPGOptions.h
You can also set options and save them, though this should be the job of GPGPreferences only.
Options are defined by a name, a state (active or not), and, optionally (sic), a value.
Some options (keyserver-options) can have sub-options too.
Synopsis:
GPGOPTIONS_H
NSMutableArray *optionFileLines;
NSMutableArray *optionNames;
NSMutableArray *optionValues;
NSMutableArray *optionStates;
NSMutableArray *optionLineNumbers;
BOOL hasModifications;
optionFileLines No description. optionNames No description. optionValues No description. optionStates No description. optionLineNumbers No description. hasModifications No description.
File locationsGnuPG version
- + gpgPath
- + optionsFilename
GnuPG home directory
- + gnupgVersion
HTTP proxy
- + homeDirectory
- + setHomeDirectory:
- + homeDirectoryChanged
Setting options
- + httpProxy
- + setHttpProxy:
- + httpProxyChanged
Getting options
- - setOptionValue:atIndex:
- - setEmptyOptionValueAtIndex:
- - setOptionName:atIndex:
- - setOptionState:atIndex:
- - addOptionNamed:
- - insertOptionNamed:atIndex:
- - removeOptionAtIndex:
- - moveOptionsAtIndexes:toIndex:
Sub-options
- - optionNames
- - optionValues
- - optionStates
- - optionValueForName:
- - setOptionValue:forName:
- - setEmptyOptionValueForName:
- - optionStateForName:
- - setOptionState:forName:
Loading and saving options
- - subOptionState:forName:
- - setSubOption:state:forName:
Getting inactive and active options
- - reloadOptions
- - saveOptions
- - allOptionValuesForName:
- - activeOptionValuesForName:
+ (NSString *)gnupgVersion
Returns current GnuPG version, or raises an exception when GnuPG executable cannot be found or returned an error.
+ (NSString *)gpgPath
Returns the expected location of GnuPG. Currently hardcoded to /usr/local/bin/gpg, due to libgpgme.
+ (NSString *)homeDirectory
Returns the home directory used by GnuPG, as configured by user. Maybe user will need to logout and login to get it active, due to the use of environment variable GNUPGHOME.
+ (BOOL)homeDirectoryChanged
Returns whether user changed GnuPG's home directory, i.e. +homeDirectory is equal or not to {+currentHomeDirectory}.
+ (NSString *)httpProxy
Returns the HTTP proxy used by GnuPG, when connecting to key servers. Maybe user will need to logout and login to get it active, due to the use of environment variable http_proxy.
+ (BOOL)httpProxyChanged
Returns whether user changed GnuPG's HTTP proxy, i.e. +httpProxy is equal or not to +currentHttpProxy.
+ (NSString *)optionsFilename
Returns the full path name to GnuPG configuration file. It depends on GnuPG version. If user changed GnuPG's home directory without logging out and in, returned value might be not yet valid.
Raises an exception when GnuPG version cannot be found out.
+ (void)setHomeDirectory:(NSString *)homeDirectory
Sets the home directory for GnuPG. Maybe user will need to logout and login to get it active, due to the use of environment variable GNUPGHOME.
+ (void)setHttpProxy:(NSString *)httpProxy
Sets the HTTP proxy to be used by GnuPG, when connecting to key servers. Maybe user will need to logout and login to get it active, due to the use of environment variable http_proxy.
- (NSArray *)activeOptionValuesForName:(NSString *)name
Returns all values set for this option name, providing that option is active. First value is the used value, in case no more than one value is considered by GnuPG.
- (void)addOptionNamed:(NSString *)name
Adds a new option named name, not active, with an empty value.
- (NSArray *)allOptionValuesForName:(NSString *)name
- (void)insertOptionNamed:(NSString *)name atIndex:(unsigned)index
- (unsigned)moveOptionsAtIndexes:(NSArray *)indexes toIndex:(unsigned)index
Reorders options at indexes to new index. Returns new index.
- (NSArray *)optionNames
Returns all option names, active or not. The same option name can appear multiple times.
- (BOOL)optionStateForName:(NSString *)name
- (NSArray *)optionStates
Returns all option states as an array of NSNumber instances (boolean values). There are as many option states as option names returned by -optionNames.
- (NSString *)optionValueForName:(NSString *)name
Returns the option value named name, used by GnuPG. In case of multiple occurences of the a named option, returns the used one. Note that option might be inactive!
- (NSArray *)optionValues
Returns all option values, active or not. There are as many option values as option names returned by -optionNames.
- (void)reloadOptions
Re-reads GnuPG's configuration file. If user changed GnuPG's home directory without logging out and in, options might be not yet active, and changes won't be taken in account before logging out and in.
- (void)removeOptionAtIndex:(unsigned)index
- (void)saveOptions
Save options by writing file back. Note that if user changed GnuPG's home directory without logging out and in, new options might be not yet valid.
- (void)setEmptyOptionValueAtIndex:(unsigned)index
- (void)setEmptyOptionValueForName:(NSString *)name
- (void)setOptionName:(NSString *)name atIndex:(unsigned)index
- (void)setOptionState:(BOOL)flag atIndex:(unsigned)index
- (void)setOptionState:(BOOL)state forName:(NSString *)name
- (void)setOptionValue:(NSString *)value atIndex:(unsigned)index
- (void)setOptionValue:(NSString *)value forName:(NSString *)name
- (void)setSubOption:(NSString *)subOptionName state:(BOOL)state forName:(NSString *)optionName
Sets subOptionName sub-option's state, in option named optionName.
- (BOOL)subOptionState:(NSString *)subOptionName forName:(NSString *)optionName
Returns subOptionName sub-option's state, in option named optionName.