@@ -79,21 +79,11 @@ - (instancetype)init
79
79
NSBeep ();
80
80
}
81
81
}
82
+
82
83
return self;
83
84
}
84
85
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 -
97
87
98
88
- (void )helpViewerClosed : (NSNotification *)notification
99
89
{
@@ -104,10 +94,14 @@ - (void)helpViewerClosed:(NSNotification *)notification
104
94
- (void )openOnlineHelpForTopic : (NSString *)searchString
105
95
{
106
96
NSString *version = nil ;
107
- if (![mySQLConnection serverVersionIsGreaterThanOrEqualTo: 4 minorVersion: 1 releaseVersion: 0 ])
97
+
98
+ if (![mySQLConnection serverVersionIsGreaterThanOrEqualTo: 4 minorVersion: 1 releaseVersion: 0 ])
99
+ {
108
100
version = @" 4.1" ;
109
- else
101
+ }
102
+ else {
110
103
version = [NSString stringWithFormat: @" %u .%u " ,(unsigned int )[mySQLConnection serverMajorVersion ], (unsigned int )[mySQLConnection serverMinorVersion ]];
104
+ }
111
105
112
106
NSString *url = [[NSString stringWithFormat:
113
107
SPMySQLSearchURL,
@@ -116,7 +110,9 @@ - (void)openOnlineHelpForTopic:(NSString *)searchString
116
110
searchString]
117
111
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
118
112
119
- if ([url length ]) [[NSWorkspace sharedWorkspace ] openURL: [NSURL URLWithString: url]];
113
+ if ([url length ]) {
114
+ [[NSWorkspace sharedWorkspace ] openURL: [NSURL URLWithString: url]];
115
+ }
120
116
}
121
117
122
118
- (NSString *)HTMLHelpContentsForSearchString: (NSString *)searchString autoHelp: (BOOL )autoHelp
@@ -218,10 +214,14 @@ - (NSString *)HTMLHelpContentsForSearchString:(NSString *)searchString autoHelp:
218
214
// iterate through all found rows and print them as HTML ul/li list
219
215
[theHelp appendString: @" <ul>" ];
220
216
[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]];
224
223
}
224
+
225
225
[theHelp appendString: @" </ul>" ];
226
226
}
227
227
@@ -280,4 +280,22 @@ - (IBAction)showHelpForCurrentWord:(id)sender
280
280
[controller showHelpFor: searchString addToHistory: YES calledByAutoHelp: NO ];
281
281
}
282
282
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
+
283
301
@end
0 commit comments