I forked the JRFeedbackProvider project on github yesterday and made two commits that have already been pulled and merged into the main branch. They're small, one adds a regular expression check on the email address sent in the php file to check it's format as a valid email address, the other adjusts the NSTextView's NSTextStorage to remove the bold font when using
showFeedbackWithBugDetails: to pre-populate the textview with bug details.
JRFeedbackProvider is a 'nonviral cocoa source for implementing an application feedback panel' . In short, it provides your users a standardized in-app method of providing feedback, from bug reports to to feature and support requests. The two main approaches are to use the default details pane, which asks basic questions for each category separated into three tabs/panes, and another option which allows the developer to pre-fil the bug report pane with details supplied from within the app.
The second patch I committed dealt with the latter feature. In the default
showFeedback method, the textview was pre-filled with some basic questions in bold; "what happened, what did you expect" etc. The
showFeedbackWithBugDetails route was essentially a blank text area by default with the exception of whatever the developer chose to fill it with by supplying an NSString, but this always resulted in the supplied text being in bold like the pre-filled bug report. I initially figured out that if you called
[textView setString:@""]; it would 'fix' this and the following text would be a normal font weight, but I stumbled across this thread on cocoadev that sent me in another direction. So I went back and updated the method to first grab the font in use by the textStorage's (which was bold) and creating the same font using the NSFont's
familyName method, but without the bold, like so:
1 NSFont *resetFontWeight = [[textView textStorage] font]; 2 // Font name: Helvetica-Bold 3 // Font Family Name: Helvetica 4 [[textView textStorage] setFont: 5 [NSFont fontWithName:[resetFontWeight familyName] 6 size:[resetFontWeight pointSize]]]; 7 [textView setString:details]; 8 [resetFontWeight release];
This effectively resets the font, losing the bold.