Skip to content

Commit 562eb1d

Browse files
committed
#2485: Make external links in help viewer more readable in dark mode.
1 parent 87ea3c0 commit 562eb1d

File tree

2 files changed

+40
-18
lines changed

2 files changed

+40
-18
lines changed

Resources/Templates/SPMySQLHelpTemplate.html

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
.dark .internallink {
5050
color: rgb(65, 156, 255);
5151
}
52+
53+
.dark a {
54+
color: rgb(65, 156, 255);
55+
}
5256
</style>
5357
<script type="text/javascript">
5458
window.onThemeChange = function(theme) {

Source/SPHelpViewerClient.m

+36-18
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,11 @@ - (instancetype)init
7979
NSBeep();
8080
}
8181
}
82+
8283
return self;
8384
}
8485

85-
- (void)dealloc
86-
{
87-
[[NSNotificationCenter defaultCenter] removeObserver:self];
88-
[controller setDataSource:nil]; // we are the (unretained) datasource, but the controller may outlive us (if retained by other objects)
89-
[controller close]; // hide the window if it is still visible (can't update anymore without delegate anyway)
90-
91-
mySQLConnection = nil;
92-
SPClear(controller);
93-
SPClear(helpHTMLTemplate);
94-
SPClear(engine);
95-
[super dealloc];
96-
}
86+
#pragma mark -
9787

9888
- (void)helpViewerClosed:(NSNotification *)notification
9989
{
@@ -104,10 +94,14 @@ - (void)helpViewerClosed:(NSNotification *)notification
10494
- (void)openOnlineHelpForTopic:(NSString *)searchString
10595
{
10696
NSString *version = nil;
107-
if(![mySQLConnection serverVersionIsGreaterThanOrEqualTo:4 minorVersion:1 releaseVersion:0])
97+
98+
if (![mySQLConnection serverVersionIsGreaterThanOrEqualTo:4 minorVersion:1 releaseVersion:0])
99+
{
108100
version = @"4.1";
109-
else
101+
}
102+
else {
110103
version = [NSString stringWithFormat:@"%u.%u",(unsigned int)[mySQLConnection serverMajorVersion], (unsigned int)[mySQLConnection serverMinorVersion]];
104+
}
111105

112106
NSString *url = [[NSString stringWithFormat:
113107
SPMySQLSearchURL,
@@ -116,7 +110,9 @@ - (void)openOnlineHelpForTopic:(NSString *)searchString
116110
searchString]
117111
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
118112

119-
if([url length]) [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
113+
if ([url length]) {
114+
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
115+
}
120116
}
121117

122118
- (NSString *)HTMLHelpContentsForSearchString:(NSString *)searchString autoHelp:(BOOL)autoHelp
@@ -218,10 +214,14 @@ - (NSString *)HTMLHelpContentsForSearchString:(NSString *)searchString autoHelp:
218214
// iterate through all found rows and print them as HTML ul/li list
219215
[theHelp appendString:@"<ul>"];
220216
[theResult setDefaultRowReturnType:SPMySQLResultRowAsArray];
221-
for (NSArray *eachRow in theResult) {
222-
NSString *topic = [eachRow objectAtIndex:[eachRow count]-2];
223-
[theHelp appendFormat:@"<li>%@</li>",[[self class] linkToHelpTopic:topic]];
217+
218+
for (NSArray *eachRow in theResult)
219+
{
220+
NSString *topic = [eachRow objectAtIndex:[eachRow count] - 2];
221+
222+
[theHelp appendFormat:@"<li>%@</li>", [[self class] linkToHelpTopic:topic]];
224223
}
224+
225225
[theHelp appendString:@"</ul>"];
226226
}
227227

@@ -280,4 +280,22 @@ - (IBAction)showHelpForCurrentWord:(id)sender
280280
[controller showHelpFor:searchString addToHistory:YES calledByAutoHelp:NO];
281281
}
282282

283+
#pragma mark -
284+
285+
- (void)dealloc
286+
{
287+
[[NSNotificationCenter defaultCenter] removeObserver:self];
288+
289+
[controller setDataSource:nil]; // we are the (unretained) datasource, but the controller may outlive us (if retained by other objects)
290+
[controller close]; // hide the window if it is still visible (can't update anymore without delegate anyway)
291+
292+
mySQLConnection = nil;
293+
294+
SPClear(controller);
295+
SPClear(helpHTMLTemplate);
296+
SPClear(engine);
297+
298+
[super dealloc];
299+
}
300+
283301
@end

0 commit comments

Comments
 (0)