mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
Add GSHelpViewer user default
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27447 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6c0a0ef0cb
commit
06ff2b01a8
3 changed files with 49 additions and 15 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2008-12-29 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSHelpManager.m: Allow the GSHelpViewer user default to
|
||||||
|
control how application help is displayed.
|
||||||
|
* Documentation/GuiUser/DefaultsSummary.gsdoc: Document the new
|
||||||
|
user default.
|
||||||
|
|
||||||
2008-12-28 Fred Kiefer <FredKiefer@gmx.de>
|
2008-12-28 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSWindow.m: Remove left over traces of toolbar handling.
|
* Source/NSWindow.m: Remove left over traces of toolbar handling.
|
||||||
|
|
|
@ -100,6 +100,18 @@
|
||||||
begin with a dot ('.') are not shown in the NSSavePanel or
|
begin with a dot ('.') are not shown in the NSSavePanel or
|
||||||
NSOpenPanel.
|
NSOpenPanel.
|
||||||
</p>
|
</p>
|
||||||
|
<term>GSHelpViewer</term>
|
||||||
|
<desc>
|
||||||
|
<p>
|
||||||
|
A string which can be used to specify the name of the application
|
||||||
|
to be used to view application help.<br /> If this is not specified
|
||||||
|
(or is an empty string) the 'best' available viewer is used (an
|
||||||
|
application whose Info.plist says that it can view files of the
|
||||||
|
appropriate type ... usually rtp or rtfd files).<br />
|
||||||
|
If this is set to <code>NSHelpPanel</code> or if no application can
|
||||||
|
be used to view the help file, the help is displayed by the
|
||||||
|
shared help panel object built in to the application.
|
||||||
|
</p>
|
||||||
</desc>
|
</desc>
|
||||||
<term>GSInsertControlKeystrokes</term>
|
<term>GSInsertControlKeystrokes</term>
|
||||||
<desc>
|
<desc>
|
||||||
|
|
|
@ -166,22 +166,21 @@
|
||||||
|
|
||||||
- (void) showHelp: (id)sender
|
- (void) showHelp: (id)sender
|
||||||
{
|
{
|
||||||
NSBundle *mb = [NSBundle mainBundle];
|
NSBundle *mb = [NSBundle mainBundle];
|
||||||
NSDictionary *info = [mb infoDictionary];
|
NSDictionary *info = [mb infoDictionary];
|
||||||
NSString *help;
|
NSString *help = [info objectForKey: @"GSHelpContentsFile"];
|
||||||
|
|
||||||
help = [info objectForKey: @"GSHelpContentsFile"];
|
|
||||||
|
|
||||||
if (help == nil)
|
if (help == nil)
|
||||||
{
|
{
|
||||||
|
/* If there's no specification, we look for a files named
|
||||||
|
* "appname.rtfd" or "appname.rtf"
|
||||||
|
*/
|
||||||
help = [info objectForKey: @"NSExecutable"];
|
help = [info objectForKey: @"NSExecutable"];
|
||||||
// If there's no specification, we look for a files named
|
|
||||||
// "appname.rtfd" or "appname.rtf"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (help != nil)
|
if (help != nil)
|
||||||
{
|
{
|
||||||
NSString *file = nil;
|
NSString *file;
|
||||||
|
|
||||||
if ([[help pathExtension] length] == 0)
|
if ([[help pathExtension] length] == 0)
|
||||||
{
|
{
|
||||||
|
@ -201,21 +200,37 @@
|
||||||
|
|
||||||
if (file != nil)
|
if (file != nil)
|
||||||
{
|
{
|
||||||
if ([[NSWorkspace sharedWorkspace] openFile: file] == YES)
|
BOOL result = NO;
|
||||||
|
NSString *ext = [file pathExtension];
|
||||||
|
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
|
||||||
|
NSString *viewer;
|
||||||
|
|
||||||
|
viewer = [[NSUserDefaults standardUserDefaults]
|
||||||
|
stringForKey: @"GSHelpViewer"];
|
||||||
|
|
||||||
|
if ([viewer isEqual: @"NSHelpPanel"] == NO)
|
||||||
{
|
{
|
||||||
return;
|
if ([viewer length] == 0)
|
||||||
|
{
|
||||||
|
viewer = [ws getBestAppInRole: @"Viewer" forExtension: ext];
|
||||||
|
}
|
||||||
|
if (viewer != nil)
|
||||||
|
{
|
||||||
|
result = [[NSWorkspace sharedWorkspace] openFile: file
|
||||||
|
withApplication: viewer];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (result == NO)
|
||||||
{
|
{
|
||||||
NSHelpPanel *panel = [NSHelpPanel sharedHelpPanel];
|
NSHelpPanel *panel;
|
||||||
NSString *ext = [file pathExtension];
|
|
||||||
NSTextView *tv;
|
NSTextView *tv;
|
||||||
id object;
|
id object;
|
||||||
|
|
||||||
|
panel = [NSHelpPanel sharedHelpPanel];
|
||||||
tv = [(NSScrollView*)[panel contentView] documentView];
|
tv = [(NSScrollView*)[panel contentView] documentView];
|
||||||
|
|
||||||
if (ext == nil
|
if (ext == nil
|
||||||
|| [ext isEqualToString: @""]
|
|| [ext isEqualToString: @""]
|
||||||
|| [ext isEqualToString: @"txt"]
|
|| [ext isEqualToString: @"txt"]
|
||||||
|| [ext isEqualToString: @"text"])
|
|| [ext isEqualToString: @"text"])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue